Add nesting depth threshold and fix ProjectResolver fallback#3
Open
Add nesting depth threshold and fix ProjectResolver fallback#3
Conversation
The tool already tracked maxNestingDepth per function but did not use it for flagging. Functions like GetJobInfoAsync (nesting depth 7) in IntegrationPipelineService.cs were not flagged despite being clearly hard to maintain. Over 2,000 deeply nested functions across the analyzed repos went undetected because the report only checked line count and cyclomatic complexity. Add --threshold-nesting (default 4) to all three CLI commands. The HTML report now includes a Deeply Nested category alongside Long Functions and High Complexity, with its own concern-score contribution (3 pts per function, plus 3 bonus pts at 2x the threshold). The repository ranking table gains Nested, Max Nesting columns, and each repo detail section shows a Deeply Nested table when applicable. Also fix ProjectResolver returning null for .cs files that have no .csproj in their ancestor directory chain. When the ancestor walk fails, the resolver now scans all project files in the repo and picks the one with the deepest common path prefix. This fills in the empty Project cells in the report. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The tool already tracked maxNestingDepth per function but never used it for flagging. Functions like GetJobInfoAsync (nesting depth 7) in IntegrationPipelineService.cs were not flagged despite being clearly hard to maintain. Over 2,000 deeply nested functions across the analyzed repos went undetected because the report only checked line count and cyclomatic complexity.
This adds --threshold-nesting (default 4) to all three CLI commands (analyze is unchanged since it just outputs JSON; report and run now accept the threshold). The HTML report now includes a Deeply Nested category alongside Long Functions and High Complexity, with its own concern-score contribution (3 pts per function, plus 3 bonus pts at 2x the threshold). The repository ranking table gains Nested and Max Nesting columns, and each repo detail section shows a Deeply Nested table when applicable.
Also fixes ProjectResolver returning null for .cs files that have no .csproj in their ancestor directory chain. When the ancestor-walk fails, the resolver now lazily scans all project files in the repo and picks the one with the deepest common path prefix. This fills in the previously empty Project cells in the report (987 functions affected in the sample run).