flake8-max-function-length


Nameflake8-max-function-length JSON
Version 0.9.0 PyPI version JSON
download
home_pageNone
SummaryA configurable flake8 plugin to enforce a maximum function/method length.
upload_time2024-10-11 21:37:25
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.9.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/7a/95/2b086991c3f584b4a2646539b8505121e5071d60102fec416d98664efbc2/flake8_max_function_length-0.9.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.9.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.9.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": "2c043823fb0a564b571048b5a9f6cec9e5e3dac68a6edd7e2ee3cd14aab6e513",
                "md5": "b8b2dbcabeaf5dcb33ab3ce5560134cb",
                "sha256": "6493eed66d95a22a6cf0fd8b38c99f4a58cec4269f0187453544639351a54e02"
            },
            "downloads": -1,
            "filename": "flake8_max_function_length-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b8b2dbcabeaf5dcb33ab3ce5560134cb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5159,
            "upload_time": "2024-10-11T21:37:24",
            "upload_time_iso_8601": "2024-10-11T21:37:24.108764Z",
            "url": "https://files.pythonhosted.org/packages/2c/04/3823fb0a564b571048b5a9f6cec9e5e3dac68a6edd7e2ee3cd14aab6e513/flake8_max_function_length-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7a952b086991c3f584b4a2646539b8505121e5071d60102fec416d98664efbc2",
                "md5": "26c1fc6ab8b982ed7b0429fb20548b0b",
                "sha256": "031d47724cb853fecc16483e6b3445fb1dec620283e568b845eb8c64835d8f73"
            },
            "downloads": -1,
            "filename": "flake8_max_function_length-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "26c1fc6ab8b982ed7b0429fb20548b0b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9034,
            "upload_time": "2024-10-11T21:37:25",
            "upload_time_iso_8601": "2024-10-11T21:37:25.861533Z",
            "url": "https://files.pythonhosted.org/packages/7a/95/2b086991c3f584b4a2646539b8505121e5071d60102fec416d98664efbc2/flake8_max_function_length-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 21:37:25",
    "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.65734s