ISSUE DESCRIPTION Schrödinger's comment: it is both commented-out code and a comment…
- User
ISSUE DESCRIPTION
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)
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- Assistant
I’ll trace the ERA001 detection and RUF100 unused-noqa logic, reproduce the two-line case, then adjust the smallest shared or rule-specific behavior. I’ll run focused tests and the relevant broader test suite, and inspect the final diff before submission.
- Assistant
The reproduction confirms the root cause: ERA001 reports the first comment, while the second comment is not recognized as code because its trailing
# noqatext makes the remainder unparsable; consequently RUF100 sees no suppressed ERA001 diagnostic. I’ll make ERA001 ignore a trailing noqa directive while classifying the comment body, preserving the directive for normal suppression processing. This causes the second line to produce the ERA001 diagnostic that its own noqa suppresses, eliminating the contradictory RUF100 report. - Assistant
The focused eradication tests pass, and the reproduction now emits only the original ERA001 diagnostic with no RUF100 warning. I’m doing a few edge-case checks (case-insensitive directives, colon/no-colon forms, and code containing a string that mentions
# noqa) plus formatting/status verification before submitting. - Assistant
All checks are clean: focused eradicate tests pass, the full Rust formatting check passes, and
git diff --checkreports no whitespace problems. The edge check confirms case-insensitive and blanketnoqadirectives work, while a literal# noqainside a code string is not incorrectly stripped. The only modified file is the ERA001 detector.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.