crapkit computes a CRAP score (complexity multiplied by uncovered risk) for every function in a code repository, ranks the worst functions by file change frequency, and blocks commits that increase the debt. It parses Python, TypeScript, TSX, JavaScript, Swift, Go, Rust, shell, PowerShell, C/C++, Objective-C, Vue, Java, and Zig via lizard, and reads per-function branch coverage already produced by istanbul or coverage.py. The JSON command uses sort keys and a versioned schema for use by scripts, coding agents, and the optional MCP server.
Main capabilities: per-function CRAP scores, uncovered lines, and near-duplicates; generation of a worklist ranked by change frequency; and a ratchet gate so markers can only go down, making it easier to pay down debt incrementally. The default complexity ceiling is 6; above the ceiling, coverage cannot save a function and it can only be split. You can set target = 30 in crapkit.toml to use crap4j's thresholds.
Usage: for Python repositories, install with pip install "crapkit[py]", uv tool install crapkit, or pipx install crapkit; for non-Python repositories, use uvx crapkit init. The typical flow is init, coverage, worklist, ratchet seed, verify, then install the commit gate. coverage requires the test runner to have the corresponding coverage plugin installed (such as pytest-cov, @vitest/coverage-v8), and pytest also requires coverage.py 7.13.1 or newer.
Limitations: only git-tracked files are scored; Python 3.11+ and Git are required; analysis runs locally and sends no telemetry, but configured lane, mutation, and alert commands run with your permissions and may access services or modify files. After upgrading, you must re-seed markers and keep the CLI and plugin versions consistent.