Summary
The human-readable codegraph stats complexity line omits maxCyclomatic, which is present in stats -j. The omission is inconsistent with how the same line treats the other two metrics.
Reproduction
On this repo (codegraph 3.16.0, full self-build):
$ codegraph stats | grep Complexity
Complexity: 4633 functions | avg cognitive: 4.1 | avg cyclomatic: 4 | max cognitive: 74 | avg MI: 65.1 | min MI: 24.7
$ codegraph stats -j | jq .complexity
{ "avgCognitive": 4.1, "avgCyclomatic": 4, "maxCognitive": 74, "maxCyclomatic": 40, ... }
maxCyclomatic: 40 is computed and exposed in JSON, but never printed.
Why it's worth fixing
The line is internally inconsistent about which extreme it reports per metric:
| Metric |
avg |
max |
min |
| cognitive |
shown |
shown |
n/a |
| cyclomatic |
shown |
missing |
n/a |
| MI |
shown |
n/a |
shown |
Cognitive gets its max, MI gets its min (the bad end for MI, since lower is worse), but cyclomatic gets only its average — so the one function at cyclomatic 40 is invisible in the default view, while the cognitive outlier at 74 is not. Average cyclomatic of 4 reads as healthy on its own.
Suggested fix
Add max cyclomatic to the text output next to max cognitive. Text and JSON should surface the same fields.
Found while writing .codegraph/basics.md health baselines during the org-wide rollout, where stats is the natural source for those numbers.
Related
Summary
The human-readable
codegraph statscomplexity line omitsmaxCyclomatic, which is present instats -j. The omission is inconsistent with how the same line treats the other two metrics.Reproduction
On this repo (codegraph 3.16.0, full self-build):
maxCyclomatic: 40is computed and exposed in JSON, but never printed.Why it's worth fixing
The line is internally inconsistent about which extreme it reports per metric:
Cognitive gets its max, MI gets its min (the bad end for MI, since lower is worse), but cyclomatic gets only its average — so the one function at cyclomatic 40 is invisible in the default view, while the cognitive outlier at 74 is not. Average cyclomatic of 4 reads as healthy on its own.
Suggested fix
Add
max cyclomaticto the text output next tomax cognitive. Text and JSON should surface the same fields.Found while writing
.codegraph/basics.mdhealth baselines during the org-wide rollout, wherestatsis the natural source for those numbers.Related
statsoutput (roles map double-counts dead symbols)