Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

A flake8 extension that checks cyclomatic complexity and calculates max complexity limit in runtime

Project description

# flake8-adjustable-complexity

[![Build Status](](
[![Test Coverage](](

An extension for flake8 to report on too complex functions with bad variables names.

Sometimes you want to use too generic variable name inside some function.
It this case you want to be sure that the function is more simple that
others, so a reader doesn't have to remember meaning of a variable
together with other logic for a long time.

This plugin calculates max allowed cyclomatic complexity for each function
separately. Default is 7 and it is decreased by 2 for each variable from
blacklist inside the function. If actual complexity overcomes max calculated
complexity, the plugin reports an error.

## Installation

pip install flake8-adjustable-complexity

## Example

Sample file:


def foo():
for vars in range(5):
for info in range(5):
for obj in range(5):


$ flake8 CCE001 is too complex (4 > 1)

Tested on Python 3.7.2 and flake8 3.5.0.

## 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.

Files for flake8-adjustable-complexity, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size flake8_adjustable_complexity-0.0.1.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page