Skip to content

A flake8 plugin that prevents you from writing "too many" bad codes.

License

Notifications You must be signed in to change notification settings

queensferryme/flake8-too-many

Repository files navigation

flake8-too-many

python: 3.7+ pre-commit.ci status github ci status codecov

A flake8 plugin that prevents you from writing "too many" bad codes.

Installation

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

Error Codes

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

Options

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.