crap4rust
crap4rust computes CRAP scores for Rust functions by combining complexity and test coverage.
It is published as the Cargo subcommand package cargo-crap4rust, so the command is cargo crap4rust.
Current status and release notes:
- IMPLEMENTED-FEATURES.md documents what
0.1.xsupports today - ROADMAP.md tracks planned capabilities beyond the first release
- CHANGELOG.md records released versions
Documentation Map
- Start with this README for installation and basic usage
- Read IMPLEMENTED-FEATURES.md for the current shipped scope
- Read ROADMAP.md for planned phases and longer-term direction
- Read CHANGELOG.md for release history
Install
cargo install cargo-crap4rust
License
Licensed under either of:
What It Does
- Computes a CRAP score for each discovered Rust function
- Generates coverage automatically with
cargo llvm-covwhen--coverageis omitted - Prints a single report to the console
- Supports multiple
--packageflags for one aggregated report
Examples
Analyse the default package for a manifest:
cargo crap4rust --manifest-path C:\Projects\my-workspace\Cargo.toml
Analyse one specific package in a workspace:
cargo crap4rust --manifest-path C:\Projects\my-workspace\Cargo.toml --package app-core
Analyse multiple packages and produce one combined console report:
cargo crap4rust --manifest-path C:\Projects\my-workspace\Cargo.toml --package app-core --package app-validation
Use a precomputed coverage export instead of generating coverage automatically:
cargo crap4rust --manifest-path C:\Projects\my-workspace\Cargo.toml --package app-core --coverage C:\Projects\my-workspace\target\coverage.json
Use stricter project thresholds:
cargo crap4rust --manifest-path C:\Projects\my-workspace\Cargo.toml --threshold 25 --project-threshold 3.0 --strict
Current Scope
The current implementation focuses on:
- console reporting
- automatic
cargo llvm-covintegration - internal cognitive-complexity scoring
- workspace package selection and aggregation
See IMPLEMENTED-FEATURES.md for the shipped feature set and ROADMAP.md for the broader plan.