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
Now let me look at the noqa directive parsing utilities:
- Assistant
Now let me check the eradicate test setup and ERA001 fixture:
- Assistant
Now update the ERA001 rule:
- Assistant
Now let's check how the RUF100_5 test is configured:
- Assistant
No
ghCLI available, so I'll describe the regression case without an issue number. Add fixture cases: - Assistant
Now run the tests:
- Assistant
All tests pass and only the intended snapshots changed. Now clippy and a manual end-to-end check of the reported case:
- Assistant
Edge cases behave correctly. Now run
prekon the changed files per the repo guidelines: - Assistant
uvxisn't available in this environment, so I'll runcargo fmtdirectly as the closest substitute: - Assistant
Formatting is clean. Final review of the source changes:
- Assistant
All green. Cleaning up the temp repro:
- Assistant
The fix is complete. Here's a summary:
Root cause
ERA001 passed the entire comment line — including any trailing
# noqadirective — tocomment_contains_code(). For# ) # noqa: ERA001, the appended directive text broke the brackets-only positive case (^[()\[\]{}\s]+$) and made the parse fail, so ERA001 didn't fire. With no ERA001 diagnostic to suppress, RUF100 then reported the directive as unused — a catch-22 where the suppression comment defeats itself.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.