flake8 should only consider a noqa comment if it is actually a comment
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
Did you already have something in mind to fix this?
If I'm following correctly (disclaimer: I'm new to Flake8's internals), the inline noqa check comes from this regex, is it desired to come up with a solution to this that fits into the regex? Or, maybe overthinking, can we do something like tokenize the line if the regex matches and check for a noqa comment (around here)?
yeah I'm planning to maybe rework this into a pipeline based on the tokenization (since that has to happen for linting anyway) -- I don't really want to shoehorn it into the existing structure as I'll probably be reworking that. I think the regex is still relevant but it should only be tested against COMMENT tokens