flake8-functions


Nameflake8-functions JSON
Version 0.0.8 PyPI version JSON
download
home_pagehttps://github.com/best-doctor/flake8-functions
SummaryA flake8 extension that checks functions
upload_time2023-04-10 15:53:16
maintainer
docs_urlNone
authorValery Pavlov
requires_python
licenseMIT
keywords flake8
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # flake8-functions

[![Build Status](https://travis-ci.org/best-doctor/flake8-functions.svg?branch=master)](https://travis-ci.org/best-doctor/flake8-functions)
[![Maintainability](https://api.codeclimate.com/v1/badges/4cdbd67833752665ee79/maintainability)](https://codeclimate.com/github/best-doctor/flake8-functions/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/4cdbd67833752665ee79/test_coverage)](https://codeclimate.com/github/best-doctor/flake8-functions/test_coverage)
[![PyPI version](https://badge.fury.io/py/flake8-functions.svg?)](https://badge.fury.io/py/flake8-functions)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-functions)

An extension for flake8 to report on issues with functions.

We believe code readability is very important for a team that consists of
more than one person. One of the issues we've encountered is functions
that are more that two screens long.

The validator checks for:

* CFQ001 - function length (default max length is 100)
* CFQ002 - function arguments number (default max arguments amount is 6)
* CFQ003 - function is not pure.
* CFQ004 - function returns number (default max returns amount is 3)

## Installation

```terminal
pip install flake8-functions
```

## Example

```python
def some_long_function(
    first_parameter: int,
    second_parameter: int,
    third_parameter: int,
):
    first_parameter = (
        first_parameter +
        second_parameter +
        third_parameter
    )

    first_parameter = (
        first_parameter +
        second_parameter +
        third_parameter
    )

    first_parameter = (
        first_parameter +
        second_parameter +
        third_parameter
    )

    first_parameter = (
        first_parameter +
        second_parameter +
        third_parameter
    )

    return first_parameter
```

Usage:

```terminal
$ flake8 --max-function-length=20 test.py
test.py:1:0: CFQ001 "some_long_function" function has length 25
that exceeds max allowed length 20
```

## Error codes

| Error code |                     Description                                                                    |
|:----------:|:--------------------------------------------------------------------------------------------------:|
|   CFQ001   | Function "some_function" has length %function_length% that exceeds max allowed length %max_length% |
|   CFQ002   | Function "some_function" has %args_amount% arguments that exceeds max allowed %max_args_amount%    |
|   CFQ003   | Function "some_function" is not pure.                                                              |
|   CFQ004   | Function "some_function" has %returns_amount% returns that exceeds max allowed %max_returns_amount%|

## Code prerequisites

1. Python 3.7+;

## Contributing

We would love you to contribute to our project. It's simple:

1. Create an issue with bug you found or proposal you have.
   Wait for approve from maintainer.
1. Create a pull request. Make sure all checks are green.
1. Fix review comments if any.
1. Be awesome.

Here are useful tips:

* You can run all checks and tests with `make check`.
  Please do it before TravisCI does.
* We use [BestDoctor python styleguide](https://github.com/best-doctor/guides/blob/master/guides/en/python_styleguide.md).
* We respect [Django CoC](https://www.djangoproject.com/conduct/).
  Make soft, not bullshit.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/best-doctor/flake8-functions",
    "name": "flake8-functions",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "flake8",
    "author": "Valery Pavlov",
    "author_email": "lerikpav@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7e/f4/af475b75382a6403a6a184f01ae42e8c9bdd97ee8e84b4c4d6660da0f4d9/flake8_functions-0.0.8.tar.gz",
    "platform": null,
    "description": "# flake8-functions\n\n[![Build Status](https://travis-ci.org/best-doctor/flake8-functions.svg?branch=master)](https://travis-ci.org/best-doctor/flake8-functions)\n[![Maintainability](https://api.codeclimate.com/v1/badges/4cdbd67833752665ee79/maintainability)](https://codeclimate.com/github/best-doctor/flake8-functions/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/4cdbd67833752665ee79/test_coverage)](https://codeclimate.com/github/best-doctor/flake8-functions/test_coverage)\n[![PyPI version](https://badge.fury.io/py/flake8-functions.svg?)](https://badge.fury.io/py/flake8-functions)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-functions)\n\nAn extension for flake8 to report on issues with functions.\n\nWe believe code readability is very important for a team that consists of\nmore than one person. One of the issues we've encountered is functions\nthat are more that two screens long.\n\nThe validator checks for:\n\n* CFQ001 - function length (default max length is 100)\n* CFQ002 - function arguments number (default max arguments amount is 6)\n* CFQ003 - function is not pure.\n* CFQ004 - function returns number (default max returns amount is 3)\n\n## Installation\n\n```terminal\npip install flake8-functions\n```\n\n## Example\n\n```python\ndef some_long_function(\n    first_parameter: int,\n    second_parameter: int,\n    third_parameter: int,\n):\n    first_parameter = (\n        first_parameter +\n        second_parameter +\n        third_parameter\n    )\n\n    first_parameter = (\n        first_parameter +\n        second_parameter +\n        third_parameter\n    )\n\n    first_parameter = (\n        first_parameter +\n        second_parameter +\n        third_parameter\n    )\n\n    first_parameter = (\n        first_parameter +\n        second_parameter +\n        third_parameter\n    )\n\n    return first_parameter\n```\n\nUsage:\n\n```terminal\n$ flake8 --max-function-length=20 test.py\ntest.py:1:0: CFQ001 \"some_long_function\" function has length 25\nthat exceeds max allowed length 20\n```\n\n## Error codes\n\n| Error code |                     Description                                                                    |\n|:----------:|:--------------------------------------------------------------------------------------------------:|\n|   CFQ001   | Function \"some_function\" has length %function_length% that exceeds max allowed length %max_length% |\n|   CFQ002   | Function \"some_function\" has %args_amount% arguments that exceeds max allowed %max_args_amount%    |\n|   CFQ003   | Function \"some_function\" is not pure.                                                              |\n|   CFQ004   | Function \"some_function\" has %returns_amount% returns that exceeds max allowed %max_returns_amount%|\n\n## Code prerequisites\n\n1. Python 3.7+;\n\n## Contributing\n\nWe would love you to contribute to our project. It's simple:\n\n1. Create an issue with bug you found or proposal you have.\n   Wait for approve from maintainer.\n1. Create a pull request. Make sure all checks are green.\n1. Fix review comments if any.\n1. Be awesome.\n\nHere are useful tips:\n\n* You can run all checks and tests with `make check`.\n  Please do it before TravisCI does.\n* We use [BestDoctor python styleguide](https://github.com/best-doctor/guides/blob/master/guides/en/python_styleguide.md).\n* We respect [Django CoC](https://www.djangoproject.com/conduct/).\n  Make soft, not bullshit.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A flake8 extension that checks functions",
    "version": "0.0.8",
    "split_keywords": [
        "flake8"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e31a2ff8d074e42ad864fe5378cff28ccf758d4b039167c5384480b703aea222",
                "md5": "41b273df95e8fbac813d9b60039436ea",
                "sha256": "e1a88aa634d1aff6973f8c9dd64f30ab2beaac661e52eea96929ccc7ee7f64df"
            },
            "downloads": -1,
            "filename": "flake8_functions-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "41b273df95e8fbac813d9b60039436ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6946,
            "upload_time": "2023-04-10T15:53:14",
            "upload_time_iso_8601": "2023-04-10T15:53:14.448310Z",
            "url": "https://files.pythonhosted.org/packages/e3/1a/2ff8d074e42ad864fe5378cff28ccf758d4b039167c5384480b703aea222/flake8_functions-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ef4af475b75382a6403a6a184f01ae42e8c9bdd97ee8e84b4c4d6660da0f4d9",
                "md5": "fdab1ace3178a5d520ae696be895f547",
                "sha256": "5446626673a9faecbf389fb411b90bdc87b002c387b72dc097b208e7a58f2a1c"
            },
            "downloads": -1,
            "filename": "flake8_functions-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "fdab1ace3178a5d520ae696be895f547",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5496,
            "upload_time": "2023-04-10T15:53:16",
            "upload_time_iso_8601": "2023-04-10T15:53:16.099807Z",
            "url": "https://files.pythonhosted.org/packages/7e/f4/af475b75382a6403a6a184f01ae42e8c9bdd97ee8e84b4c4d6660da0f4d9/flake8_functions-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-10 15:53:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "best-doctor",
    "github_project": "flake8-functions",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flake8-functions"
}
        
Elapsed time: 0.10408s