← ClaudeAtlas

code-quality-metricslisted

Measuring code quality with numbers that drive decisions: cyclomatic and cognitive complexity, duplication, coupling and cohesion (Ca, Ce, instability, abstractness, LCOM4), dependency-graph cycles, churn x complexity hotspots from git history, type coverage and lint baselines with ratchets; exact tool commands per language, a bundled hotspot script, and the prioritized refactor-list format. Load when assessing codebase health, choosing refactor targets, setting CI quality gates, or comparing a module before and after a refactor.
rustcircle/c101 · ★ 0 · Code & Development · score 65
Install: claude install-skill rustcircle/c101
# Code quality metrics Metrics are triage, not verdicts. A number earns attention only when it is (a) extreme relative to the rest of this codebase, (b) in code that changes often, and (c) linked to a cost: defects, slow changes, or untestable logic. Every recommendation you make cites the numbers and the command that produced them. ## 1. Metric quick reference | Metric | Measures | Computation | Function-level thresholds (green / amber / red) | Main tools | |---|---|---|---|---| | Cyclomatic complexity (CCN) | Independent (basis) paths; tests for basis-path coverage, an upper bound for branch coverage | decisions + 1 (if, loop, case, catch, `&&`, `\|\|`, ternary) | <= 10 / 11-20 / > 20 (> 50 untestable) | lizard, radon, gocyclo, PMD, ESLint `complexity` | | Cognitive complexity | Effort to understand; penalizes nesting | +1 per flow break, + nesting level for nested structures | <= 15 / 16-25 / > 25 | SonarQube rules, complexipy, gocognit, `eslint-plugin-sonarjs`, clippy | | Length | Size of a unit | NLOC (non-comment lines) | <= 60 / 61-120 / > 120 | lizard, scc | | Parameters | Interface width | count | <= 4 / 5-6 / > 6 | lizard `-a` | | Nesting depth | Indentation of logic | max block depth | <= 3 / 4 / > 4 | linters (`max-depth`, ruff PLR1702) | | Duplication | Copy-paste debt | % duplicated tokens/lines | < 3% / 3-5% / > 5% of new code | jscpd, PMD CPD, Sonar | | Efferent coupling Ce | What a module depends on | outgoing deps | relative; watch top 5% | dep graphs | |