Skip to main content

flake8-max-function-length

A configurable flake8 plugin to enforce a maximum function/method length.

GitHub Workflow Status PyPI PyPI PyPI - License Code style: black

Installation

Install with pip

pip install flake8-max-function-length

Configuration Options

The package has only one rule MFL000 to check that function length is equal or lower to a maximum value. By default, the function length should be lower than 50 lines and is calculated based on its content ignoring its docstring, comments and empty lines. Still, you have the ability to customize that based on the following options:

  • --max-function-length=n: Maximum allowed function length. (Default: 50)
  • --mfl-include-function-definition: Include the function definition line(s) when calculating the function length. (Default: disabled)
  • --mfl-include-docstring: Include the length of the docstring when calculating the function length. (Default: disabled)
  • --mfl-include-empty-lines: Include empty lines inside the function when calculating the function length. (Default: disabled)
  • --mfl-include-comment-lines: Include comment lines when calculating the function length. (Default: disabled)

Usage with pre-commit

repos:
  - repo: https://github.com/pycqa/flake8
    rev: '6.0.0'
    hooks:
      - id: flake8
        #args: [ --max-function-length, '100', --mfl-include-docstring, --mfl-include-comment-lines ]
        additional_dependencies: [ "flake8-max-function-length==0.10.0" ]

Similar tools

License

This project is MIT licensed.

Metadata

Release files for flake8-max-function-length 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-max-function-length 0.10.0
File Size Uploaded
flake8_max_function_length-0.10.0.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8-max-function-length 0.10.0
File Interpreter ABI Platform
flake8_max_function_length-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / flake8_max_function_length-0.10.0.tar.gz

Download URL flake8_max_function_length-0.10.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bd0984f36334be8428e92da98f72ff365494b97df74abbf49e296531043d8d14
BLAKE2b-256 checksum
How to use checksums
5ad7f28938f5b1e5cf4b341f2fd69c6405370f1239f19dccc670bfd2b26f605d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.5

Release files / flake8_max_function_length-0.10.0-py3-none-any.whl

Download URL flake8_max_function_length-0.10.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f93bb3e82fd63fe4a56205e6edc8c5270328ec60a1c9de331a94509cd2b1a2cc
BLAKE2b-256 checksum
How to use checksums
adad90c0c377dbb66daaf158fe9d4678f9966f005103e0e58875026394a6e271
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.5

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page