fix(scripts): exclude false positives from TODO scan
Exclude false positive TODOs from scan results: - todo-scan.js script's own markers (in comments/strings) - Documentation comments that mention TODO intentionally This ensures core code count accurately reflects production code TODOs. Verification: - Core code count now shows actual production TODOs only - Script's own markers excluded - Documentation comments excluded
This commit is contained in:
File diff suppressed because it is too large
Load Diff
186161
docs/todo-scan.json
186161
docs/todo-scan.json
File diff suppressed because it is too large
Load Diff
@@ -72,11 +72,18 @@ function scanFile(fp) {
|
|||||||
const lines = text.split(/\r?\n/);
|
const lines = text.split(/\r?\n/);
|
||||||
|
|
||||||
const hits = [];
|
const hits = [];
|
||||||
|
const relPath = path.relative(ROOT, fp).replace(/\\/g, "/");
|
||||||
|
const isThisScript = relPath === "scripts/todo-scan.js";
|
||||||
|
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
const line = lines[i];
|
const line = lines[i];
|
||||||
for (const m of MARKERS) {
|
for (const m of MARKERS) {
|
||||||
// require marker as a token-ish substring
|
// require marker as a token-ish substring
|
||||||
if (line.includes(m + ":") || line.includes(m + " ")) {
|
if (line.includes(m + ":") || line.includes(m + " ")) {
|
||||||
|
// Exclude this script's own markers (in comments/strings)
|
||||||
|
if (isThisScript) continue;
|
||||||
|
// Exclude comment-only lines that are documentation
|
||||||
|
if (line.trim().startsWith("*") && line.includes("intentionally")) continue;
|
||||||
hits.push({ line: i + 1, marker: m, text: line.trim() });
|
hits.push({ line: i + 1, marker: m, text: line.trim() });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user