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

Method getIndexHealth

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

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

Callers 2

mainFunction · 0.80

Calls 4

hasGrammarLoadFailureFunction · 0.90
isFileLevelOnlyLanguageFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected