Complexity limits
Measures cyclomatic complexity, function length and nesting and fails when a change pushes a function past a limit.
Sub-techniques
2
| ID | Name | Description |
|---|---|---|
V1012.001 | Complexity thresholds | Per-function limits on cyclomatic or cognitive complexity. |
V1012.002 | Size budgets | Limits on function, file and parameter counts. |
Craft it
- Measure the current distribution and set the limit at the existing worst case.
- Lower it over time; never block on files the change did not touch.
- Prefer a linter rule (ruff C901, ESLint complexity) over a separate tool.
Reverse engineer it
Signs that a codebase already runs this technique, and where to read how it is configured.
- max-complexity or complexity rules in linter config.
- radon or lizard reports in CI.