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:
Matthew Raymer
2025-12-24 08:20:18 +00:00
parent 2d70c03cf4
commit 5c75592740
3 changed files with 165206 additions and 37770 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -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;
} }