« Back to Index

[Python ignore pylint and flake8 linter errors]

View original Gist on GitHub

Tags: #tags: python, linter, ignore, pylint, flake8

Python ignore pylint flake8 errors.md

Disable all linting across the entire file:

# pylint: disable-all (older)
# pylint: skip-file   (newer)
# flake8: noqa

Disable specific linting errors across the entire file:

# pylint: disable=123

Note: flake8 can’t do this, unless you use something like tox.ini
So by adding ignore = F403,E501 in a [flake8] section of setup.cfg or tox.ini I’ve also seen this to be configurable with a .flake8 file instead of a tox.ini

Disable specific linting errors for specific lines:

some_code  # noqa: E731,E123
some_code  # noqa pylint: disable=unused-import