flake8-max-function-length


Nameflake8-max-function-length JSON
Version 0.8.0 PyPI version JSON
download
home_pageNone
SummaryA configurable flake8 plugin to enforce a maximum function/method length.
upload_time2023-10-07 06:43:29
maintainerNone
docs_urlNone
authorGhazi Abbassi
requires_python>=3.8
licenseNone
keywords flake8 flake8 plugin maximum function length
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # flake8-max-function-length

A configurable [flake8](https://github.com/pycqa/flake8) plugin to enforce a maximum function/method length.

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ghazi-git/flake8-max-function-length/tests.yml?branch=main&label=Tests&logo=GitHub)](https://github.com/ghazi-git/flake8-max-function-length/actions/workflows/tests.yml)
[![PyPI](https://img.shields.io/pypi/v/flake8-max-function-length)](https://pypi.org/project/flake8-max-function-length/)
[![PyPI](https://img.shields.io/pypi/pyversions/flake8-max-function-length?logo=python&logoColor=white)](https://pypi.org/project/flake8-max-function-length/)
[![PyPI - License](https://img.shields.io/pypi/l/flake8-max-function-length)](https://github.com/ghazi-git/flake8-max-function-length/blob/main/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

## Installation

Install with `pip`

```shell
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

```yaml
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.8.0" ]
```

## Similar tools

- flake8-functions has a similar rule for maximum function length, however, it [doesn't allow excluding empty lines
and comments](https://github.com/best-doctor/flake8-functions/issues/9).
- Pylint has the [too-many-statements](https://pylint.readthedocs.io/en/latest/user_guide/checkers/features.html#design-checker-messages)
rule, which is also similar to this one. Still, I find it easier to reason about number of lines as opposed to
number of statements.

## License

This project is [MIT licensed](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "flake8-max-function-length",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "flake8,flake8 plugin,maximum function length",
    "author": "Ghazi Abbassi",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/3d/86/eefa1220568491fb29feb764b530a7fd9b8f0aff9e6bfca32b60ae2543a5/flake8_max_function_length-0.8.0.tar.gz",
    "platform": null,
    "description": "# flake8-max-function-length\n\nA configurable [flake8](https://github.com/pycqa/flake8) plugin to enforce a maximum function/method length.\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ghazi-git/flake8-max-function-length/tests.yml?branch=main&label=Tests&logo=GitHub)](https://github.com/ghazi-git/flake8-max-function-length/actions/workflows/tests.yml)\n[![PyPI](https://img.shields.io/pypi/v/flake8-max-function-length)](https://pypi.org/project/flake8-max-function-length/)\n[![PyPI](https://img.shields.io/pypi/pyversions/flake8-max-function-length?logo=python&logoColor=white)](https://pypi.org/project/flake8-max-function-length/)\n[![PyPI - License](https://img.shields.io/pypi/l/flake8-max-function-length)](https://github.com/ghazi-git/flake8-max-function-length/blob/main/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n## Installation\n\nInstall with `pip`\n\n```shell\npip install flake8-max-function-length\n```\n\n## Configuration Options\n\nThe package has only one rule `MFL000` to check that function length is equal or lower to a maximum value.\nBy default, the function length should be lower than 50 lines and is calculated based on its content ignoring\nits docstring, comments and empty lines. Still, you have the ability to customize that based on the following\noptions:\n\n- `--max-function-length=n`: Maximum allowed function length. (Default: 50)\n- `--mfl-include-function-definition`: Include the function definition line(s) when calculating the function length.\n(Default: disabled)\n- `--mfl-include-docstring`: Include the length of the docstring when calculating the function length.\n(Default: disabled)\n- `--mfl-include-empty-lines`: Include empty lines inside the function when calculating the function length.\n(Default: disabled)\n- `--mfl-include-comment-lines`: Include comment lines when calculating the function length. (Default: disabled)\n\n## Usage with pre-commit\n\n```yaml\nrepos:\n  - repo: https://github.com/pycqa/flake8\n    rev: '6.0.0'\n    hooks:\n      - id: flake8\n        #args: [ --max-function-length, '100', --mfl-include-docstring, --mfl-include-comment-lines ]\n        additional_dependencies: [ \"flake8-max-function-length==0.8.0\" ]\n```\n\n## Similar tools\n\n- flake8-functions has a similar rule for maximum function length, however, it [doesn't allow excluding empty lines\nand comments](https://github.com/best-doctor/flake8-functions/issues/9).\n- Pylint has the [too-many-statements](https://pylint.readthedocs.io/en/latest/user_guide/checkers/features.html#design-checker-messages)\nrule, which is also similar to this one. Still, I find it easier to reason about number of lines as opposed to\nnumber of statements.\n\n## License\n\nThis project is [MIT licensed](LICENSE).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A configurable flake8 plugin to enforce a maximum function/method length.",
    "version": "0.8.0",
    "project_urls": {
        "Changelog": "https://github.com/ghazi-git/flake8-max-function-length/releases",
        "Code": "https://github.com/ghazi-git/flake8-max-function-length",
        "Issues": "https://github.com/ghazi-git/flake8-max-function-length/issues"
    },
    "split_keywords": [
        "flake8",
        "flake8 plugin",
        "maximum function length"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5892ec56693dc8be0b2a1a5b139c54090f6509619e2c5abb034cf4ec6b602437",
                "md5": "5cb7f09ba193e1f6932d6812ab522add",
                "sha256": "b1c39ff7e2de38e598594599f68b82e3e45a3dd4230c416101e62ec015d0c1a2"
            },
            "downloads": -1,
            "filename": "flake8_max_function_length-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5cb7f09ba193e1f6932d6812ab522add",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5157,
            "upload_time": "2023-10-07T06:43:27",
            "upload_time_iso_8601": "2023-10-07T06:43:27.368734Z",
            "url": "https://files.pythonhosted.org/packages/58/92/ec56693dc8be0b2a1a5b139c54090f6509619e2c5abb034cf4ec6b602437/flake8_max_function_length-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3d86eefa1220568491fb29feb764b530a7fd9b8f0aff9e6bfca32b60ae2543a5",
                "md5": "98063cb0093390e2e819e4901f10107e",
                "sha256": "a459c128dd0895fe771010e0edcca5a594afc220c0b183d7a467cb8994990aea"
            },
            "downloads": -1,
            "filename": "flake8_max_function_length-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "98063cb0093390e2e819e4901f10107e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8910,
            "upload_time": "2023-10-07T06:43:29",
            "upload_time_iso_8601": "2023-10-07T06:43:29.310558Z",
            "url": "https://files.pythonhosted.org/packages/3d/86/eefa1220568491fb29feb764b530a7fd9b8f0aff9e6bfca32b60ae2543a5/flake8_max_function_length-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-07 06:43:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ghazi-git",
    "github_project": "flake8-max-function-length",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flake8-max-function-length"
}
        
Elapsed time: 0.12314s