DEBT-006 recommended metrics

Code complexity trends

Code complexity is measured and tracked over time to catch debt accumulation early.

Question to ask

"Which file is your most complex — and is it getting worse?"

Pass criteria

  • Complexity measured (ESLint rule or equivalent)
  • Trend visible (reports, CI history)
  • Team aware of complexity hotspots

Fail criteria

  • No complexity measurement
  • Measured but not tracked over time
  • Thresholds always ignored

Related items

section: 8, items: CRAP score section: 28, items: Code quality tools

Verification guide

Severity: Optional

Code complexity is a leading indicator of technical debt. Tracking trends helps catch debt accumulation early.

Check automatically:

# Look for complexity tooling config
find . -maxdepth 3 -type f \( -name ".codeclimate*" -o -name "sonar-project.properties" -o -name ".plato*" -o -name "complexity-report*" \) 2>/dev/null

# Check for complexity in CI
grep -riE "complexity|codeclimate|sonarqube|sonar|plato" .github/workflows/ .circleci/ .gitlab-ci.yml Jenkinsfile 2>/dev/null

# Look for eslint complexity rules
grep -riE "complexity|max-depth|max-nested" .eslintrc* eslint.config* 2>/dev/null

Ask user:

  • "Is code complexity measured?" (ESLint rules, SonarQube, CodeClimate, manual audits)
  • "Can you see trends over time?" (dashboard, reports, CI history)
  • "Are there thresholds that fail builds or warn?"

Common tools:

Tool What it measures
ESLint complexity rule Cyclomatic complexity per function
SonarQube Complexity, duplication, code smells
CodeClimate Maintainability grade, complexity
Plato JS complexity reports

Pass criteria:

  • Complexity measured (at least ESLint rule or equivalent)
  • Trend visible (reports over time, or CI history)
  • Team aware of complexity hotspots

Fail criteria:

  • No complexity measurement
  • Measured but not tracked over time
  • Thresholds exist but always ignored/overridden

Cross-reference with:

  • Section 8 (CRAP score)
  • Section 28 (Code Architecture - SOLID, quality tools)

Evidence to capture:

  • Complexity tools in use
  • Thresholds configured
  • Whether trends are tracked
  • Recent complexity scores (if available)

Section

40. Technical Debt Tracking

Team & Development