Forbid unused `noqa` comments
See original GitHub issueRule request
Thesis
We should raise a warning when noqa
comment is unused.
However, I am not sure that this is possible without patching flake8
.
Reasoning
Consider this example:
some_variable = 12 # noqa: A001
A001
means that your name overrides some python
builtin.
But, it does not look like so. Or does it?
This kind of errors happen to have historical roots. At some point in time they were actually used, but then the code was refactored. But the comment was left untouched.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How do I get Pyflakes to ignore a statement? - Stack Overflow
Tips # noqa: F841 means ignoring only F841 error at the line. – SangminKim. Feb 12, 2018 at 16:00. | Show 6 more...
Read more >Ignoring Errors with Flake8 — flake8 3.1.1 documentation
If we ever want to disable Flake8 respecting # noqa comments, we can can refer to flake8 --disable-noqa . If we instead had...
Read more >noqa does not suppress the warning for flake8
I still want to see the warning for unused imports but if I use # noqa I want them ... which will allow...
Read more >Common issues and solutions - mypy 0.991 documentation
You can add a # type: ignore comment to tell mypy to ignore this error: ... to silence complaints about unused imports from...
Read more >Remove Unused Imports & Unused Variables from Python Code
To prevent that, without having to exclude the entire file, you can add a # noqa comment at the end of the line,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think there is another related option: https://pypi.org/project/flake8-noqa/