flake8 should only consider a noqa comment if it is actually a comment
Open
Nobody has claimed this yet.
bug:confirmed
confirmed-by:core
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 356
- PR merge metrics
- No merged PRs in 30d
Description
minimal reproduction:
def f():
x = '# noqa'
I expect this to report the same as if that were an unrelated string:
def f():
x = '......'
$ flake8 unrelated.py
unrelated.py:2:5: F841 local variable 'x' is assigned to but never used
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal Python reproduction in the issue and run the shown flake8 unrelated.py command to observe the false suppression. Trace how flake8 decides whether # noqa is a comment, then add a regression test showing that the string literal does not suppress F841; done means the warning matches the unrelated-string example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100