A flake8 plugin that prevents you from writing "too many" bad codes.
with pip
pip install flake8-too-many
with poetry
poetry add -D flake8-too-many
with pre-commit
(doc)
repos:
- repo: https://github.com/PyCQA/flake8
rev: '' # pick a git hash/tag
hooks:
- id: flake8
additional_dependencies:
# ...
- flake8-too-many
code | description | example |
---|---|---|
TMN001 | function has too many arguments. | link |
TMN002 | function returns too many values. | link |
TMN003 | function has too many return statements. | link |
TMN004 | unpacking has too many targets. | link |
These options could be either passed in as command line flags, or specified in a .flake8
configuration file.
--max-function-arguments
, int, default to 6;--ignore-defaulted-arguments
, bool, default to false;
--max-function-return-values
, int, default to 3;--max-function-return-stmts
, int, default to 3;--max-unpacking-targets
, int, default to 3.
Run flake8 -h
for detailed description of each option.