ac - Aggregate Complexity
The ac command calculates aggregate complexity for C# projects or solutions. Aggregate Complexity (AC) is a project-level metric that sums the cyclomatic complexity contributions from all methods, providing a single number that represents the overall complexity of your codebase.
Only methods whose individual cyclomatic complexity score is 10 or greater contribute to the Aggregate Complexity total. Methods below that threshold are ignored entirely. This focuses attention on methods that exceed healthy complexity thresholds and keeps the metric stable for well-maintained codebases where most methods are simple.
nmbl ac <Path> [options]
Path- Path to a .csproj file, .slnx solution file, or directory containing C# files
--verbose,-v- Show breakdown of methods contributing to AC
By default, outputs just the integer aggregate complexity value. With --verbose, displays a table of contributing methods.
nmbl ac src/MyProject/MyProject.csproj
Outputs just the aggregate complexity number:
12
nmbl ac MySolution.slnx
Calculates AC across all projects in the solution.
nmbl ac src/MyProject/ --verbose
Shows contributing methods:
Analyzing 45 C# file(s)...
Methods contributing to Aggregate Complexity:
╭───────────────────────────────────────────────────────╮──────────────╮─────────────────╮
│ Method │ Complexity │ AC Contribution │
├───────────────────────────────────────────────────────┼──────────────┼─────────────────┤
│ MyNamespace.OrderProcessor.ProcessOrder(Order) │ 25 │ 2 │
│ MyNamespace.ReportGenerator.GenerateReport(int, bool) │ 18 │ 1 │
│ MyNamespace.DataValidator.ValidateAll(object[]) │ 12 │ 1 │
╰───────────────────────────────────────────────────────╯──────────────╯─────────────────╯
Total methods analyzed: 128
Methods contributing to AC: 3 (CC >= 10)
Aggregate Complexity: 4
The simple integer output makes ac ideal for CI/CD pipelines:
# Check if aggregate complexity exceeds threshold
$ac = nmbl ac src/MyProject/
if ($ac -gt 50) {
Write-Error "Aggregate complexity too high: $ac"
exit 1
}
Aggregate Complexity helps you:
- Track technical debt - Monitor overall complexity trends over time
- Compare projects - Objectively compare complexity between projects
- Set thresholds - Establish complexity budgets for teams or projects
- Identify hotspots - Use
--verboseto find the most complex methods
Typical AC Values:
- 0-10: Small, well-maintained codebase
- 10-50: Medium project with some complex areas
- 50-100: Large project or significant complexity
- 100+: Large project requiring attention to complexity