Collect candidate files.
(p, out)
| 72 | |
| 73 | /** Collect candidate files. */ |
| 74 | function 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 | |
| 98 | const files = []; |
| 99 | for (const p of paths) collect(path.resolve(p), files); |
no test coverage detected