High complexity (both)
What a high-complexity finding of fallow health means, why it matters and how to fix it.
What it reports
Function exceeds both complexity thresholds.
Health explains how fallow finds it.
Why it matters
Function exceeds both cyclomatic and cognitive complexity thresholds. This is the strongest signal that a function needs refactoring, it has many paths and is hard to understand. The same rule fires on synthetic <template> findings in every supported template dialect (Angular .html templates and inline @Component({ template: ... }) literals, Vue SFC <template> blocks, Svelte markup, Astro markup) when both metrics exceed their thresholds, and on synthetic <component> rollup findings whose totals are the worst class method's score plus the template's. Ranking and --targets use the rollup totals; JSON exposes the per-half breakdown under component_rollup.
Example
parseRow has a cyclomatic complexity of 24 and a cognitive complexity of 31, so the function exceeds both thresholds: it has many paths, and the paths are deeply nested.
Fix
For function findings, extract named helpers, split independent branches, flatten guard clauses, and add tests around the behavior before refactoring. For <template> findings, flatten nested control flow and move branch selection out of the markup: Angular @if/@for/@switch/@defer and legacy *ngIf/*ngFor into computed signals on the component class, Vue v-if/v-else-if/v-for into computed properties, Svelte {#if}/{:else if}/{#each}/{#await}/{#key} into derived state, Astro control flow into props resolved in the frontmatter. In Svelte, moving a repeated or deeply nested block into a top-level {#snippet} gives it its own <snippet:NAME> unit with nesting rebased to zero, so the in-file extraction moves the score; splitting a large template into child components lowers the score in every dialect. For <component> rollup findings, attack the larger half first; the per-half breakdown lives in component_rollup. To report these findings without a failed run, set the complexity-cyclomatic or complexity-cognitive rule to warn.
Facts
| Fact | Value |
|---|---|
| Issue type | high-complexity |
| Rule id in SARIF output | fallow/high-complexity |
| Command | fallow health |
| Filter option | --complexity |
| Suppression comment | // fallow-ignore-next-line complexity |
Fixable with fallow fix | No |