MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / getIndexHealth

Method getIndexHealth

src/index.ts:3077–3103  ·  view source on GitHub ↗

* Indexed files whose symbols are missing although their content is current * — rows a content-hash comparison calls up to date (#2336). Reported by * `status`; `sync` repairs the `needsReindex` group.

()

Source from the content-addressed store, hash-verified

3075 * `status`; `sync` repairs the `needsReindex` group.
3076 */
3077 getIndexHealth(): IndexHealth {
3078 const needsReindex: string[] = [];
3079 const parseErrors: string[] = [];
3080 const oversize: IndexHealth['oversize'] = [];
3081 for (const file of this.queries.getFilesWithoutNodesOrWithErrors()) {
3082 const errors = file.errors ?? [];
3083 if (hasGrammarLoadFailure(errors)) {
3084 // Stored without being parsed — its grammar could not load (#2335).
3085 needsReindex.push(file.path);
3086 } else if (file.nodeCount === 0) {
3087 // Every parse stores at least the file node, so zero nodes means a
3088 // wiped row (#1541) or a recorded failure — except file-level-only
3089 // languages and files over the size limit, which are empty on purpose.
3090 if (isFileLevelOnlyLanguage(file.language)) continue;
3091 if (errors.some((e) => e.code === 'size_exceeded')) {
3092 oversize.push({ path: file.path, size: file.size });
3093 continue;
3094 }
3095 if (errors.length === 0) needsReindex.push(file.path);
3096 else if (errors.some((e) => e.severity === 'error' || e.code === 'parse_error')) parseErrors.push(file.path);
3097 } else if (errors.some((e) => e.code === 'parse_error')) {
3098 // Parsed, but the tree had errors and no symbols survived.
3099 parseErrors.push(file.path);
3100 }
3101 }
3102 return { needsReindex, parseErrors, oversize };
3103 }
3104
3105 /**
3106 * Files found against files that yielded symbols, by language. Reported by

Callers 3

mainFunction · 0.80

Calls 4

hasGrammarLoadFailureFunction · 0.90
isFileLevelOnlyLanguageFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected