You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(rules): bug-todo matches the word "todo" in identifiers, module names and prose (22 of 22 hits were false positives) #681
bug-todo reports "TODO/FIXME/HACK/XXX comment found. Consider resolving before merge." for any occurrence of the word todo, case-insensitively, including in code and ordinary prose. Projects that have a to-do feature (task lists, todo_write, a todo module) get a flood of info-level false positives.
Reproduction (cora 0.19.0, cora scan --no-llm)
src/a.rs:
pubmod todo;// line 1 -> reported (false positive: a module name)fnf(){let todo_state = 1;let _ = todo_state;}// line 2 -> not reported/// the todo list is per session // line 3 -> reported (false positive: prose)fng(){}// TODO(me): real marker // line 5 -> reported (correct)
Result: 3 findings; only line 5 is a real marker.
On a real 133-file Rust workspace with a task-list feature: 22 bug-todo hits, 22 false positives (e.g. let todo_state = tole_core::todo::TodoState::new();, .register(Box::new(tole_core::todo::TodoWriteTool::new(...))), pub mod todo;, doc comments about "todo state is per-session", a CHANGELOG line). Zero real TODO markers were present.
Proposal
Match only deliberate markers:
case-sensitive TODO, FIXME, HACK, XXX as whole words,
only inside a comment (//, ///, /* */, #, --, <!-- -->, %), not in code or string literals,
optionally followed by (owner) or :.
Keep the message and severity. A rules_engine option (or bug-todo params) for extra marker words would be a nice follow-up.
Done when
The repro reports only line 5; a regression test covers identifier, module name, prose in a comment ("the todo list"), lower-case todo, and the real markers TODO:, TODO(x):, FIXME, HACK, XXX.
Related: #663 (test-code awareness for built-in rules).
Activity
fix(rules): flag only deliberate TODO markers, skip eprintln and inva…
fix(rules): flag only deliberate TODO markers, skip eprintln and inva…
chore(release): v0.20.0