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 classifies adjacent comment blocks and how
noqasuppression is mapped, then add a focused regression test and run the narrow Ruff test suite plus hooks. - Assistant
rgisn’t installed in this checkout, so I’m switching to repository-local search tools and keeping the investigation scoped to ERA001/RUF100. - Assistant
The contradiction comes from ERA001’s special “brackets-only” recognizer: it accepts
# ), but stops recognizing the same code when an inline comment such as# noqa: ERA001follows it. I’m extending that existing recognizer to allow trailing comments, then covering both raw detection and the ERA001/RUF100 interaction. - Assistant
The focused detector tests pass. The combined regression also now behaves consistently: the annotated closing parenthesis consumes its ERA001 suppression, while the preceding unannotated line remains the only ERA001 diagnostic. I’m reviewing the updated snapshot before broader verification.
- Assistant
All 2,775 Ruff linter tests and doctests pass, and the full snapshot-enabled run changed only the intended regression snapshot. I’m running the required repository hooks on the three modified files now.
- Assistant
The repository hook runner can’t start because
uvxis not installed in this environment. I’ll still run the relevant local formatting/lint checks directly and verify the final diff; no external installation is needed.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.