A curated list of awesome flake8 extensions.
Inspired after reading a post.
- All-in-one
- Bugs
- Clean code
- Limitations
- Naming
- Complexity
- Comments
- Docstrings
- Tools
- Imports
- Testing
- Type annotations
- Library-specific checks
- Integrations
- Wrappers
- Formatters
Extensions with more than 20 rules inside.
- dlint - Tool for encouraging best coding practices and helping ensure Python code is secure.
- flake8-bugbear - Finding likely bugs and design problems in your program.
- flake8-pie - Extension that implements misc. lints.
- flake8-simplify - Plugin that helps you to simplify code.
- hacking - Set of flake8 plugins that test and enforce the OpenStack StyleGuide.
- wemake-python-styleguide - The strictest and most opinionated python linter ever.
Extensions for finding possible bugs.
- flake8-2020 - Plugin which checks for misuse of
sys.version
orsys.version_info
. - flake8-alfred - Alfred is a flake8 plugin to warn on unsafe/obsolete symbols.
- flake8-async - A flake8 plugin that checks for bad async / asyncio practices.
- flake8-dunder-all - Ensures that modules have defined
__all__
. - flake8-encodings - Identify incorrect use of encodings.
- flake8-mutable - Detect usage of mutable objects as default values for arguments.
- flake8-qt-tr - Detect incorrectly wrapped Qt translation text.
- flake8-requirements - Package requirements checker.
- flake8-secure-coding-standard - Enforce some secure coding standards for Python.
- flake8-slots - Require
__slots__
to be defined for subclasses of immutable types. - flake8-strftime - Checks for use of platform-specific strftime codes.
- flake8-string-format - Check that indexed parameters are used in strings.
- flake8-unused-arguments - Warn against unused arguments in functions.
- flake8-useless-assert - Detect useless
assert
statements. - flake8-warnings - Detect usage of deprecated modules, classes, and functions.
Extensions for finding stylistic issues and enforcing consistent codestyle.
- flake8-all-not-strings - Checks that if modules under
__all__
are defined as strings. - flake8-class-attributes-order - Checks classes attributes order.
- flake8-clean-block - Plugin to enforce a blank line after if/for/while/with/try blocks.
- flake8-commas - Enforcing trailing commas in python.
- flake8-comprehensions - Helps you write better list/set/dict comprehensions.
- flake8-datetime-utcnow-plugin - Plugin to warn the developer of the usage of
datetime.utcnow()
. - flake8-datetimez - A plugin for flake8 to ban the usage of unsafe naive datetime class.
- flake8-implicit-str-concat - Plugin to encourage correct string literal concatenation.
- flake8-indent-in-def - Plugin to enforce 8-space indentation in function and class definitions.
- flake8-literal - Enforces consistent styling of string literals.
- flake8-multiline-containers - Plugin to ensure a consistent format for multiline containers.
- flake8-newspaper-style - Ensures the function definition goes below its usage.
- flake8-obey-import-goat - Allows to forbid specific imports.
- flake8-picky-parentheses - Checks for redundant parentheses and alignment of parentheses and brackets.
- flake8-quotes - Extension for checking quotes in python.
- flake8-return - Plugin that checks return values.
- flake8-scream - Rules which do have known false-positives but might still be useful for a one-time run.
- flake8-sql - Plugin that checks SQL code against opinionated style rules.
- flake8-strict - Checks Python code against a set of opinionated style rules.
- flake8-too-many - Plugin that prevents you from writing "too many" bad codes.
- tryceratops - Prevent exception handling antipatterns.
Extensions banning specific Python features.
- flake8-broken-line - Report line break with backslash (
\
). - flake8-debugger - Report debug statements (
pdb
,ipdb
). - flake8-forbidden-func - Forbid some functions in some modules.
- flake8-logging - Reports issues in using the standard library logging module.
- flake8-logging-format - Report string formatting inside logging.
- flake8-match - Report
match
statement. - flake8-no-implicit-concat - Report implicit string concatenation.
- flake8-no-pep420 - Report implicit namespace packages.
- flake8-pep3101 - Report
%
-formatting. - flake8-print - Report
print
statement. - flake8-printf-formatting - Report
%
-formatting. - flake8-use-fstring - Report
%
-formatting andstr.format
. - flake8-use-pathlib - Report
os.path
. - flake8-walrus - Report walrus operator (
:=
).
Extensions for checking names of variables, functions, etc.
- flake8-builtins - Check for python builtins being used as variables or parameters.
- flake8-functions-names - Validate functions names, decomposition and conformity with annotations.
- flake8-test-name - Checks that test functions names follow a given convention.
- flake8-variables-names - Extension that helps to make more readable variables names.
- pep8-naming - Check the PEP-8 naming conventions.
Extensions for ensuring low code complexity.
- cohesion - Extension for measuring Python class cohesion.
- flake8-annotations-complexity - Plugin to validate annotations complexity.
- flake8-cognitive-complexity - Extension for flake8 that validates cognitive functions complexity.
- flake8-expression-complexity - Plugin to validate expressions complexity.
- flake8-functions - Plugin for validation of function parameters (length, complexity, etc).
- flake8-length - Smart line length validation.
Extensions for checking comments.
- flake8-ado - Check that all Azure DevOps IDs mentioned in the comments are in the correct format and have the corresponding ADO item.
- flake8-author - Checks Python modules for
__author__
attributes. - flake8-coding - Adds coding magic comment checks (coding:) to flake8.
- flake8-comments - Reports redundant comments.
- flake8-copyright - Adds copyright checks to flake8.
- flake8-eradicate - Plugin to find commented out or dead code.
- flake8-executable - Plugin for checking executable permissions and shebangs.
- flake8-fixme - Check for FIXME, TODO and other temporary developer notes.
- flake8-jira-todo-checker - Check that every TODO comment has a valid JIRA issue ID next to it.
- flake8-noqa - Validate
# noqa
comments. - flake8-ownership - Checker for assuring that author, copyright, and license are specified in source files.
- flake8-todo - Check for TODO notes.
- flake8-todos - Lint TODO comments to be consistent and have an issue linked.
Extensions for checking docstrings.
- flake8-docstring-checker - Checks if everything has a docstring.
- flake8-docstrings - Include checks provided by pep257.
- flake8-docstrings-complete - Linter that checks docstrings of functions, methods and classes.
- flake8-rst-docstrings - Validate Python docstrings as reStructuredText (RST).
- flake8-spellcheck - Spellcheck variables, classnames, comments, docstrings etc.
- flake8-sphinx-links - Check docstrings for double backticked strings which should be links to the Python documentation.
- pydoclint - A Python docstring linter that checks arguments, returns, yields, and raises sections.
Tools empowering flake8.
- flake8-codes - CLI tool to introspect flake8 plugins and their codes.
- flake8-pyproject - Flake8 plug-in loading the configuration from pyproject.toml.
- flake8-pyprojecttoml - Adds support for reading flake8 config from pyproject.toml.
- flake8-ruler - More powerful configs for flake8.
- flakehell - Wrapper to make it nice, legacy-friendly, and configurable.
- flakes - Web list of flake8 plugins and their codes, a wrapper around flake8-codes.
- nitpick - Enforce the same lint configuration (flake8, isort, mypy, pylint) across multiple Python projects.
- wps-playground - Online playground for wemake-python-styleguide.
- yesqa - A tool to automatically remove unnecessary
# noqa
comments. - flake8-in-file-ignores - Allow in file ignore e.g.
# flake8-in-file-ignores: noqa: E731
.
Extensions for checking import statements.
- flake8-absolute-import - Plugin to require absolute imports.
- flake8-alphabetize - Checking the order of
import
statements and the__all__
list. - flake8-datetime-import - Enforce importing
datetime as dt
andtime as tm
. - flake8-future-import - Extension to check imports.
- flake8-import-conventions - How certain packages should be imported or aliased.
- flake8-import-order-spoqa - Spoqa's import order style for flake8-import-order.
- flake8-import-order - Include checks import order against various Python Style Guides.
- flake8-import-style - Plugin to ensure explicit module imports.
- flake8-internal-name-import - Plugin that reports imports of protected names.
- flake8-tidy-imports - Extension that helps you write tidier imports.
- flake8-type-checking - Plugin lets you know which imports to move in or out of type-checking blocks.
Extensions for testing.
- flake8-aaa - Lints tests against the Arrange Act Assert pattern.
- flake8-assertive - Unittest assert method checker.
- flake8-mock - Provides checking mock non-existent methods.
- flake8-mock-spec - Enforce the use of the spec argument on mocks ensuring that your use of mocks is compliant with the interface of the object being mocked.
- flake8-pytest-style - Checks for common style issues or inconsistencies with pytest-based tests.
- flake8-pytest - Enforces to use
pytest
-style assertions. - flake8-pytestrail - Checks TestRail test case IDs.
Extensions for type annotations.
- flake8-annotations-coverage - Plugin to validate annotations coverage.
- flake8-annotations - Plugin for flake8 to check for presence of type annotations in function definitions.
- flake8-future-annotations - Verifies Python 3.7+ files use
from __future__ import annotations
. - flake8-new-union-types - Plugin to enforce new Union/Optional syntax
Foo | Bar | None
defined in PEP 604. - flake8-pep585 - Enforce new style annotations from PEP585 such as
list[int]
instead oftyping.List[int]
. - flake8-pep604 - Forbids use of
typing.Union
(in favour of|
), per PEP 604. - flake8-typing-imports - Plugin which checks that typing imports are properly guarded.
Extensions for linting usage of specific libraries.
- flake8-django-migrations - Plugin to lint for backwards incompatible database migrations in Django.
- flake8-django - Plugin for Django projects.
- flake8-fastapi - Checks FastAPI code against opinionated style rules.
- flake8-numba - Plugin that facilitates code development with
numba
package. - flake8-scrapy - Plugin to catch common issues on Scrapy spiders.
- pandas-vet - Plugin that provides opinionated linting for pandas code.
- TorchFix - Plugin for code that uses PyTorch.
Extensions for running flake8 not only on Python files.
- flake8-markdown - Lints Python code blocks in Markdown files using flake8.
- flake8-nb - Runs flake8 on
*.ipynb
(jupyter notebook) files. - flake8-pyi - Plugin for Flake8 that provides specializations for type hinting stub files.
- flake8-rst - Checks on code in
*.rst
files or in docstrings. - jupyterlab-flake8 - Jupyterlab python linter for notebooks and text files using flake8.
Wrappers around other tools making it possible to use them with flake8.
- flake8-bandit - Wrapper around bandit.
- flake8-black - Wrapper around black.
- flake8-isort - Wrapper around isort.
- flake8-pylint - Wrapper around pylint.
Extensions for formatting flake8 output.
- flake8-dashboard - Generates an HTML dashboard.
- flake8-for-pycharm - Generates pylint-style JSON output.
- flake8-github - Generates GitHub annotation for PR's.
- flake8-gl-codeclimate - Generates GitLab Code Quality artifacts.
- flake8-html - Generates an HTML report.
- flake8-json - Generates JSON output.