Skip to main content

Jones Complexity checker, plugin for flake8

Project description

Flake8 extension to calculate per-line complexity and total code density.

Installation

$ pip install jones-complexity

Usage (Standalone)

$ python -m jones_complexity --min 5 your_file.py

Usage (flake8)

$ flake8 --max-line-complexity 15 --max-jones-score 8 yourproject

What is this?

Because

if user.get_full_name().toUpper().split(' ')[0] == 'ALICE':
    return True

is harder to read and maintain than

if first_name == 'Alice':
   return True

Shamelessly named after myself, in the tradition of McCabe and Halstead.

Examples

Itself:

$ python jones_complexity.py jones_complexity.py
Line counts:
{
    "39": 19,
    "46": 15,
    "137": 12,
    "115": 12,
    [...]
    "18": 1,
    "9": 1,
    "148": 1
}
Jones Score:
4.0

PyEsprima:

$ p jones_complexity.py pyesprima.py
Line counts:
{
    "4182": 265,
    "3688": 190,
    "4186": 189,
    "48": 189,
    "4181": 164,
    [...]
    "1201": 1,
    "3728": 1
}
Jones Score:
9.0

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

jones-complexity-0.1.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

jones_complexity-0.1.2-py2-none-any.whl (5.8 kB view details)

Uploaded Python 2

File details

Details for the file jones-complexity-0.1.2.tar.gz.

File metadata

File hashes

Hashes for jones-complexity-0.1.2.tar.gz
Algorithm Hash digest
SHA256 801bebd57317c2bfe8ca47a8d537749ad4aa7f641ed0ef25a1dfd74f7a7b60c1
MD5 f4f07c5731d3ee3018a8491878d0bac9
BLAKE2b-256 7c94e3fc33adcd42cfaf301575c42a9f816aa15b6ccaec8c97d8f6bb089afea7

See more details on using hashes here.

File details

Details for the file jones_complexity-0.1.2-py2-none-any.whl.

File metadata

File hashes

Hashes for jones_complexity-0.1.2-py2-none-any.whl
Algorithm Hash digest
SHA256 aa636165499d077537a9942d020e8ab148ab7fa3be8c0cafbf6693a77e5759f1
MD5 fb51dbbd2073cfe0658d14a5be5a39f7
BLAKE2b-256 0cd006300564e39accf7bf7b1518871677eae4a4617ebc19efd65ad30d245358

See more details on using hashes here.

Supported by

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