TEST-005 recommended code-metrics
CRAP score calculated with project baseline
Code complexity tooling configured with established baseline/threshold for the project
Question to ask
"Which file would you least want to touch right now?"
Verification guide
Severity: Recommended
Check automatically:
Check for CRAP score tooling:
# Node.js - look for complexity tools grep -E "complexity|crap|code-climate|plato|es6-plato" package.json 2>/dev/null # PHP - phpunit has CRAP built in grep -E "crap|coverage.*crap" phpunit.xml* 2>/dev/null # Python - look for radon or similar grep -E "radon|mccabe|complexity" requirements*.txt pyproject.toml 2>/dev/nullCheck for baseline/threshold configuration:
# Look for documented thresholds grep -riE "crap.*threshold|crap.*baseline|complexity.*threshold|max.*complexity" \ README.md CLAUDE.md docs/ .eslintrc* package.json 2>/dev/nullRun CRAP/complexity analysis (if tooling exists):
# Node.js with eslint complexity rule pnpm eslint --rule 'complexity: ["error", 10]' src/ # PHP ./vendor/bin/phpunit --coverage-text | grep -A 20 "CRAP" # Python radon cc src/ -a -s
Cross-reference with:
- TEST-001 - CRAP score often calculated alongside coverage
- TODO: Section 28 (Code Architecture) - update reference once developed
- TODO: Section 40 (Technical Debt) - update reference once developed
Pass criteria:
- CRAP score or complexity tooling configured
- Baseline/threshold established for the project
- Current scores within acceptable range
Fail criteria:
- No complexity measurement tooling
- No baseline defined (can't track if it's getting worse)
- High CRAP scores ignored
If no tooling found, ask user: "No CRAP score or complexity measurement tooling found. Do you want to track code complexity? Common options: ESLint complexity rule, PHPUnit CRAP, radon (Python)."
Evidence to capture:
- Tooling detected (or none)
- Baseline/threshold value (if configured)
- Current CRAP/complexity scores for key components
- Components exceeding threshold (if any)