Direct store API traces: comment lines are skipped and each file names a tool once (a real project listed one script five times, mostly doc comments)

This commit is contained in:
CRTkafa 2026-10-22 03:22:23 +08:00
parent 5bfbcefffa
commit ee35b11341
2 changed files with 13 additions and 2 deletions

View file

@ -72,9 +72,11 @@ export function findFastlaneTraces(root: string): FastlaneTrace[] {
lines(f).forEach((l, i) => {
const m = CLI_CALL.exec(l);
if (m) out.push({ file: rel(f), line: i + 1, text: l.trim().slice(0, 200), store: storeOf(m[1]!) });
else if (!/package\.json$/.test(f) || /"[^"]*"\s*:\s*"/.test(l)) {
// comment lines name the tools without calling them; one line per file and tool is enough (a real project
// listed the same script five times, mostly from its doc comments)
else if ((!/package\.json$/.test(f) || /"[^"]*"\s*:\s*"/.test(l)) && !/^\s*(\/\/|\/?\*|#|--|REM\b)/i.test(l)) {
const d = DIRECT.find(x => x.re.test(l));
if (d) out.push({ file: rel(f), line: i + 1, text: l.trim().slice(0, 200), store: d.store, via: 'api', fix: d.fix });
if (d && !out.some(o => o.file === rel(f) && o.fix === d.fix)) out.push({ file: rel(f), line: i + 1, text: l.trim().slice(0, 200), store: d.store, via: 'api', fix: d.fix });
}
});
}