Skip to content

Add nesting depth threshold and fix ProjectResolver fallback#3

Open
Treit wants to merge 1 commit intomainfrom
u/nesting-threshold-and-project-fix
Open

Add nesting depth threshold and fix ProjectResolver fallback#3
Treit wants to merge 1 commit intomainfrom
u/nesting-threshold-and-project-fix

Conversation

@Treit
Copy link
Copy Markdown
Owner

@Treit Treit commented Apr 6, 2026

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).

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant