we started using pylint and flake8. But, I see many just adding an inline comment to disable the pylint/flake8 error/warnings. Is there a way to ignore these inline comments and generate a complete report in pylint and flake8?
You can use
flake8 --disable-noqa
I don't know if pylint has something similar (and couldn't quickly find something).
Not quite a solution, but if it helps, you can at least make pylint
issue a warning for locally disabled checks. Given foo.py
:
def foo(l): # noqa: E741 pylint: disable=invalid-name
return l + 1
you can run:
pylint --enable locally-disabled foo.py
to get:
************* Module foo
foo.py:1:0: I0011: Locally disabling invalid-name (C0103) (locally-disabled)
foo.py:1:0: C0114: Missing module docstring (missing-module-docstring)
foo.py:1:0: C0104: Disallowed name "foo" (disallowed-name)
foo.py:1:0: C0116: Missing function or method docstring (missing-function-docstring)
foo.py:1:0: C0104: Disallowed name "foo" (disallowed-name)
At least you can look for the locations with I0011
.
Update: In a comment, @pierre-sassoulas wrote that "Enabling 'suppressed-message' is pylint official ways to disable noqas": https://pylint.readthedocs.io/en/latest/user_guide/messages/information/locally-disabled.html. Thank you, Pierre, for mentioning it.
Additionally, you might want to enable https://pylint.readthedocs.io/en/latest/user_guide/messages/information/file-ignored.html, informing when entire files are being skipped.