FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ghazi-git/flake8-max-function-length: A configurable flake8 rule to enforce a maximum function/method length. · GitHub

Repository files navigation

flake8-max-function-length

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

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.

About

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

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL