Schrödinger's comment: it is both commented-out code and a comment that is not code…
- User
Schrödinger's comment: it is both commented-out code and a comment that is not code (ERA001 vs RUF100)
Summary
First, I'm impressed by the recent reduction of ERA001 false positives. I suspect that ERA001 is an exceptionally difficult rule to implement.
This is the only time I've seen this situation.
python# ) # ) # noqa: ERA001Found commented-out code (ERA001) [Ln 1, Col 4] Unused
noqadirective (unused:ERA001) (RUF100) [Ln 2, Col 10]tomlpreview = false builtins = [] target-version = "py310" line-length = 88 indent-width = 4 [lint] allowed-confusables = [] dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" extend-select = [] extend-fixable = [] external = [] ignore = [] select = [ "F", "E4", "E7", "E9", "ERA", "RUF" ] [format] indent-style = "space" quote-style = "double"Version
ruff 0.15.14 (9ad2da301 2026-05-21)
Interface
No new interfaces are introduced.
- Assistant
I’ll trace how ERA001 and RUF100 associate
noqadirectives across adjacent comment blocks, add a focused regression test, then run the narrow crate tests and hooks. - Assistant
rgisn’t installed in this checkout, so I’m using targetedgrep/findsearches instead. - Assistant
The inconsistency is in ERA001’s bracket-only heuristic:
# )is classified as code, but adding the valid trailing# noqamakes that same line fail classification. I’m fixing classification so the directive can suppress its own ERA001 diagnostic; it will not suppress the preceding line. - Assistant
The focused ERA001 tests pass, and the updated RUF100 snapshot confirms the intended result: the first
# )remains reportable, while the second line’snoqa: ERA001is now consumed instead of being flagged unused. I’m running the repository hooks on the three changed files now. - Assistant
The prescribed hook runner is unavailable in the environment (
uvx: command not found). I’ll still verify Rust formatting and re-run the regression test directly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.