flake8-too-many

October 6, 2022 ยท View on GitHub

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

codedescriptionexample
TMN001function has too many arguments.link
TMN002function returns too many values.link
TMN003function has too many return statements.link
TMN004unpacking 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.