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

Function isLowValueFile

src/db/queries.ts:37–54  ·  view source on GitHub ↗

* Files that should not be candidates for "dominant file" detection: test/spec * files and tool-generated files. Generated files (`*.pb.go`, `*.pulsar.go`, * mock outputs, …) often have huge in-file edge counts that dwarf the real * source — etcd's `rpc.pb.go` has 4× the in-file edges of `server.

(filePath: string, generated?: ReadonlySet<string>)

Source from the content-addressed store, hash-verified

35 * to catch it (#1500).
36 */
37function isLowValueFile(filePath: string, generated?: ReadonlySet<string>): boolean {
38 if (generated?.has(filePath)) return true;
39 const lp = filePath.toLowerCase();
40 return (
41 /(?:^|\/)(tests?|__tests?__|spec)\//.test(lp) ||
42 /_test\.go$/.test(lp) ||
43 /(?:^|\/)test_[^/]+\.py$/.test(lp) ||
44 /_test\.py$/.test(lp) ||
45 /_spec\.rb$/.test(lp) ||
46 /_test\.rb$/.test(lp) ||
47 /\.(test|spec)\.[jt]sx?$/.test(lp) ||
48 /(test|spec|tests)\.(java|kt|scala)$/.test(lp) ||
49 /(tests?|spec)\.cs$/.test(lp) ||
50 /tests?\.swift$/.test(lp) ||
51 /_test\.dart$/.test(lp) ||
52 isGeneratedFile(filePath)
53 );
54}
55
56const SQLITE_PARAM_CHUNK_SIZE = 500;
57

Callers 3

getDominantFileMethod · 0.85
getTopRouteFileMethod · 0.85
getRoutingManifestMethod · 0.85

Calls 2

isGeneratedFileFunction · 0.90
hasMethod · 0.80

Tested by

no test coverage detected