fix(stats): show max cyclomatic in the text complexity summary (#2384) - #2523
Merged
Conversation
The complexity line showed avg/max cognitive and avg/min MI but only avg cyclomatic, hiding the worst-case cyclomatic outlier that stats -j already exposed. Text and JSON now surface the same fields. docs check acknowledged: internal stats text-output bugfix, no README/CLAUDE.md/ROADMAP surface area changed. Impact: 2 functions changed, 2 affected
Contributor
Greptile SummaryThe PR adds the already-computed maximum cyclomatic complexity metric to the human-readable
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. Both native and JavaScript stats paths always provide maximum cyclomatic complexity for nonempty complexity results, and the updated renderer is guarded against absent complexity data. Important Files Changed
Reviews (1): Last reviewed commit: "fix(stats): show max cyclomatic in the t..." | Re-trigger Greptile |
Contributor
Codegraph Impact Analysis1 functions changed → 2 callers affected across 2 files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The human-readable
codegraph statscomplexity line omittedmaxCyclomatic, even though it's computed and present instats -j. The line was internally inconsistent about which extreme it reports per metric: cognitive gets its max, MI gets its min, but cyclomatic only got its average — so a function at cyclomatic 40 was invisible in the default view while an equivalent cognitive outlier was shown.Changes
maxCyclomaticto theComplexityInfointerface insrc/presentation/queries-cli/overview.ts(the value was already computed by both the native and JSstatspaths — this was purely a presentation-layer omission).printComplexitynow printsmax cyclomatic: Nright aftermax cognitive: N, matching the JSON shape.Verification
npx vitest run tests/presentation/queries-cli.test.ts: 31/31 pass (added a newstatstest asserting both max cognitive and max cyclomatic appear in the rendered line)codegraph diff-impact --staged: 2 functions changed, 2 callers affected (stats()and its CLIexecutewrapper — exactly the expected surface)Complexity: ... | max cognitive: 102 | max cyclomatic: 51 | avg MI: ...Closes #2384