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

Method getFileDependentCounts

src/db/queries.ts:3311–3325  ·  view source on GitHub ↗

* How many OTHER files depend on each of the given files. * * Counted through the symbols, not the file nodes: an `imports` edge points * at the imported symbol, so a file node almost never receives one and * counting edges into it would report every file as depended on by nobody. * S

(filePaths: string[])

Source from the content-addressed store, hash-verified

3309 * in the index reaches into this file" — the honest reading of a root.
3310 */
3311 getFileDependentCounts(filePaths: string[]): Array<{ filePath: string; dependents: number }> {
3312 if (filePaths.length === 0) return [];
3313 return this.db
3314 .prepare(
3315 `SELECT tn.file_path AS filePath, COUNT(DISTINCT sn.file_path) AS dependents
3316 FROM edges e
3317 JOIN nodes tn ON tn.id = e.target
3318 JOIN nodes sn ON sn.id = e.source
3319 WHERE e.kind != 'contains'
3320 AND tn.file_path IN (SELECT value FROM json_each(?))
3321 AND sn.file_path <> tn.file_path
3322 GROUP BY tn.file_path`
3323 )
3324 .all(JSON.stringify(filePaths)) as Array<{ filePath: string; dependents: number }>;
3325 }
3326
3327 /**
3328 * How far each of the given files reaches OUT: distinct other files its

Callers 2

executableFilesFunction · 0.45
filesNothingReachesFunction · 0.45

Calls 2

allMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected