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

Method getIndexHealth

src/index.ts:3094–3120  ·  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

3092 * `status`; `sync` repairs the `needsReindex` group.
3093 */
3094 getIndexHealth(): IndexHealth {
3095 const needsReindex: string[] = [];
3096 const parseErrors: string[] = [];
3097 const oversize: IndexHealth['oversize'] = [];
3098 for (const file of this.queries.getFilesWithoutNodesOrWithErrors()) {
3099 const errors = file.errors ?? [];
3100 if (hasGrammarLoadFailure(errors)) {
3101 // Stored without being parsed — its grammar could not load (#2335).
3102 needsReindex.push(file.path);
3103 } else if (file.nodeCount === 0) {
3104 // Every parse stores at least the file node, so zero nodes means a
3105 // wiped row (#1541) or a recorded failure — except file-level-only
3106 // languages and files over the size limit, which are empty on purpose.
3107 if (isFileLevelOnlyLanguage(file.language)) continue;
3108 if (errors.some((e) => e.code === 'size_exceeded')) {
3109 oversize.push({ path: file.path, size: file.size });
3110 continue;
3111 }
3112 if (errors.length === 0) needsReindex.push(file.path);
3113 else if (errors.some((e) => e.severity === 'error' || e.code === 'parse_error')) parseErrors.push(file.path);
3114 } else if (errors.some((e) => e.code === 'parse_error')) {
3115 // Parsed, but the tree had errors and no symbols survived.
3116 parseErrors.push(file.path);
3117 }
3118 }
3119 return { needsReindex, parseErrors, oversize };
3120 }
3121
3122 /**
3123 * Files found against files that yielded symbols, by language. Reported by

Calls 4

hasGrammarLoadFailureFunction · 0.90
isFileLevelOnlyLanguageFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected