Skip to content

ADR-043: CRAP Score Budgets

Proposed (deferred — revisit by 2026-11-16)

CRAP (Change Risk Anti-Patterns) is a composite metric combining cyclomatic complexity with code coverage to flag functions that are both complex and under-tested. It was proposed in 2007 by Alberto Savoia and is well-supported in Java and Clojure tooling.

The testing+agentic-discipline plan reserved this slot for CRAP-score budgets as a follow-on to ADR-042 (mutation testing). On research, the TypeScript ecosystem’s CRAP tooling is materially less mature than Clojure/Java equivalents. Available options as of 2026:

  • code-complexity packages report cyclomatic complexity but don’t compute CRAP
  • No mainstream CRAP reporter integrates with Vitest coverage
  • Custom CRAP computation (cc * (1 - coverage)²) is straightforward but requires building and maintaining the reporter

Deferred indefinitely. The marginal value over ADR-037 (testing-discipline rules) plus ADR-042 (mutation testing) is small at the template’s current scale. Revisit every six months: if TypeScript CRAP tooling matures or the codebase grows to a point where high-complexity / low-coverage functions become a recurring problem, reopen.

  • A mainstream TypeScript CRAP reporter ships and integrates with Vitest
  • The repo crosses ~10 KLOC of production code (currently under 3 KLOC)
  • A code review uncovers a high-complexity / under-tested function that escaped the existing gates

Date: 2026-05-16
Participants: Chris Pezza, Claude
Outcome: Deferred

Not enforced — this record’s status is Proposed; only Accepted ADRs are binding (see the status table in the ADR README and ADR-039).