cut-the-crap
Installation
SKILL.md
Cut the CRAP
What is CRAP?
CRAP (Change Risk Anti-Patterns) measures how risky a function is to change. It combines two factors: cyclomatic complexity (how many branches/paths) and test coverage (how much is exercised by automated tests).
Formula: CRAP(m) = comp(m)^2 * (1 - cov(m)/100)^3 + comp(m)
Reading the score:
- 1 -- trivial function, well tested. No risk.
- < 30 -- acceptable. Safe to change.
- > 30 -- CRAPpy. Too complex for its test coverage. High risk of breaking when modified.
A function with 0% coverage only needs complexity > 5 to be CRAPpy. A function with 100% coverage can have complexity up to 30 before crossing the threshold. The metric rewards either simplifying code or testing it -- ideally both.