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

Function collect

scripts/kernel-parity.mjs:74–96  ·  view source on GitHub ↗

Collect candidate files.

(p, out)

Source from the content-addressed store, hash-verified

72
73/** Collect candidate files. */
74function collect(p, out) {
75 let st;
76 try {
77 st = fs.statSync(p); // dangling symlinks (Linux-tree dtc fixtures) throw
78 } catch {
79 return;
80 }
81 if (st.isDirectory()) {
82 const base = path.basename(p);
83 if (base === 'node_modules' || base === '.git' || base === 'dist' || base === '.codegraph') return;
84 for (const e of fs.readdirSync(p)) collect(path.join(p, e), out);
85 } else if (EXTS.has(path.extname(p).toLowerCase())) {
86 // Lowercased to match the real indexer's routing (detectLanguage
87 // lowercases the extension — `.R` is the dominant real-world casing).
88 const lang = EXTS.get(path.extname(p).toLowerCase());
89 // 'detect' (.h) resolves per file in the run loop; under --lang it rides
90 // along whenever either C-family language is requested.
91 const passes =
92 !langFilter ||
93 (lang === 'detect' ? langFilter.has('c') || langFilter.has('cpp') : langFilter.has(lang));
94 if (passes) out.push({ file: p, lang });
95 }
96}
97
98const files = [];
99for (const p of paths) collect(path.resolve(p), files);

Callers 10

collectMethod · 0.85
handleCallersMethod · 0.85
handleCalleesMethod · 0.85
formatTrailMethod · 0.85
collectMethod · 0.85
emit_use_binding_refsMethod · 0.85
collectMethod · 0.85
kernel-parity.mjsFile · 0.85

Calls 3

hasMethod · 0.80
getMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected