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.
# ) # ) # noqa: ERA001Found commented-out code (ERA001) [Ln 1, Col 4] Unused
noqadirective (unused:ERA001) (RUF100) [Ln 2, Col 10]preview = 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 groups adjacent comments and how
noqasuppression is associated with the reported line, then add a focused regression test and run the relevant crate tests plus hooks. - Assistant
rgisn’t installed in this checkout, so I’m falling back to targetedgrep/findsearches. - Assistant
The inconsistency comes from ERA001’s special-case recognition of delimiter-only lines:
# )is recognized, but the same delimiter followed by an inline comment is not. I’m extending that existing case to accept trailing comments, which lets the normalnoqamachinery see and consumeERA001on the second line. - Assistant
The focused test build is compiling the linter crate and dependencies. Once it finishes, I’ll run the RUF100 integration case and inspect the updated snapshot to confirm the second directive is treated as used.
- Assistant
The updated snapshot shows the intended behavior: the unsuppressed delimiter still raises ERA001, while the matching line with
# noqa: ERA001raises neither ERA001 nor RUF100. I’m moving the regression snippet to the fixture’s end to keep the snapshot change focused, then I’ll rerun and check formatting/hooks. - Assistant
The ERA001 suite and the RUF100 regression both pass, and the snapshot contains only the expected unsuppressed first-line diagnostic—there is no unused-
noqareport for the second line. I’m running the repository’s required hooks on all three changed files now. - Assistant
The required
uvx prekhook could not start becauseuvxis not installed in this environment. I’ll still run Rust formatting checks and a final diff review; the Python fixture and snapshot need no formatter-generated changes. - Assistant
A final test without snapshot auto-acceptance is recompiling under the repository’s default test profile; this independently verifies that the checked-in snapshot matches. The hook binaries themselves remain unavailable (
uvxandrustfmt).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.