agentic-crap-py
Analyze function-level CRAP scores for Python using LCOV line coverage.
Quick start
python -m pip install agentic-crap-py
agentic-crap-py --source src --lcov coverage/lcov.info --threshold 10
For a local checkout, run python -m pip install . and then agentic-crap-py --source src --lcov coverage/lcov.info.
Coverage generation
Pass coverage generation as a JSON argv array. It is executed directly without a shell, so shell syntax, pipelines, and interpolation are intentionally not supported.
agentic-crap-py --source src --coverage-command '["python","-m","coverage","lcov","-o","coverage/lcov.info"]' --lcov coverage/lcov.info --json
An existing LCOV file is removed before this command runs. The command must create the requested LCOV file or analysis fails, preventing stale coverage from being accepted.
Output and exit codes
Use --json for deterministic compact JSON, sorted by file, line, and function.
| Exit code | Meaning |
|---|---|
0 |
Every selected function has coverage and is within the threshold. |
1 |
A CRAP score exceeds the threshold. |
2 |
Coverage is missing, malformed, unmapped, or analysis cannot run. |
Score
For cyclomatic complexity CC and line coverage ratio C, the score is:
CRAP = CC^2 * (1 - C)^3 + CC
Nested function bodies are excluded from an enclosing function's coverage and complexity calculation. A function with no mapped LCOV lines is reported as N/A and fails rather than passing.
Development
python -m unittest discover -s tests -v
Python 3.10 or newer is required. The runtime uses only the Python standard library; generate LCOV using the coverage tooling already used by your project.
Metadata
Release files for agentic-crap-py 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| agentic_crap_py-1.0.0.tar.gz | 6.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentic_crap_py-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / agentic_crap_py-1.0.0.tar.gz
| Download URL | agentic_crap_py-1.0.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
359f3ec228a1bc51caf6c6917b83c76bc690cebaa422d8f528fb78dee0a6938a
|
|
BLAKE2b-256 checksum How to use checksums |
fd14e388f7af3d0ab6c069c0834b7eb06660bd6d5038c79ceeacef4141b5459f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / agentic_crap_py-1.0.0-py3-none-any.whl
| Download URL | agentic_crap_py-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78691a7d603653cdd54b224bc1e9713ca3c1ba658ef9d3b360e23b3549ad2ef0
|
|
BLAKE2b-256 checksum How to use checksums |
5b0d3e028fe012cdbd905185df74b0f9966cb69365b67524d25c96fd8474f8ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Security for agentic-crap-py 1.0.0
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.