Skip to main content

JonesComplexity Build Status

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

Metadata

Release files for jones-complexity 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jones-complexity 0.1.2
File Size Uploaded Provenance Actions
jones-complexity-0.1.2.tar.gz 3.7 kB Without provenance Details for jones-complexity-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jones-complexity 0.1.2
File Interpreter ABI Platform Actions
jones_complexity-0.1.2-py2-none-any.whl Python 2 none any Details for jones_complexity-0.1.2-py2-none-any.whl

Total release size: 9.5 kB

Release files / jones-complexity-0.1.2.tar.gz

Download URL jones-complexity-0.1.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
801bebd57317c2bfe8ca47a8d537749ad4aa7f641ed0ef25a1dfd74f7a7b60c1
BLAKE2b-256 checksum
How to use checksums
7c94e3fc33adcd42cfaf301575c42a9f816aa15b6ccaec8c97d8f6bb089afea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / jones_complexity-0.1.2-py2-none-any.whl

Download URL jones_complexity-0.1.2-py2-none-any.whl
Size 5.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
aa636165499d077537a9942d020e8ab148ab7fa3be8c0cafbf6693a77e5759f1
BLAKE2b-256 checksum
How to use checksums
0cd006300564e39accf7bf7b1518871677eae4a4617ebc19efd65ad30d245358
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for jones-complexity 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page