Skip to main content

A flake8 extension that checks functions

Project description

flake8-functions

Build Status

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)

Installation

pip install flake8-functions

Example

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:

$ 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

Tested on Python 3.6 and 3.7.2 and flake8 3.7.5.

Error codes

Error code Description
CFQ001 Function "some_function" has length <function_length> that exceeds max allowed length <max_length>

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.
  2. Create a pull request. Make sure all checks are green.
  3. Fix review comments if any.
  4. 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. Sorry, styleguide is available only in Russian for now.
  • We respect Django CoC. Make soft, not bullshit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_functions-0.0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_functions-0.0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file flake8_functions-0.0.1.tar.gz.

File metadata

  • Download URL: flake8_functions-0.0.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for flake8_functions-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2f50f55e8c2a908ee15b89baf5e74ee4925d02860f389ec1ad9c892a46c686b6
MD5 5239936cddb84de2530b57ba8c747696
BLAKE2b-256 f820e3007d719ba00ffbc9092cab100329c301c7da9c9a617092bc857db94f63

See more details on using hashes here.

File details

Details for the file flake8_functions-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: flake8_functions-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for flake8_functions-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94c410a636398e4436749fd6a8e7a66f8da5ec82f83a15f5eabd1fb6d3cc17f7
MD5 5687fd42403a259b55d26c54a76f2387
BLAKE2b-256 8141d1970faff072f6c6fc3a520b512aef9036d1ec03bb52eb001ac878e52ab8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page