Developer Experience
Cognitive Complexity Reference
Search cognitive complexity constructs, nesting increment rules, and comparison with cyclomatic complexity. Covers SonarQube threshold defaults and language-specific rules.
No data is transmitted — everything runs locallyTool
About this tool
Cognitive Complexity Reference
The Cognitive Complexity Reference covers SonarSource cognitive complexity scoring rules, nesting increments, structural increments, and comparison with cyclomatic complexity.
• Look up how SonarQube calculates cognitive complexity for a nested if-else chain
• Understand why cognitive complexity penalizes nesting more than cyclomatic complexity
• Find the nesting increment rule for a specific language construct (ternary, logical operators)
• Check the default SonarQube cognitive complexity threshold for a CI gate
Next step
Code Churn Impact Estimator — Estimate defect risk from code churn rate in your codebase.
Open Code Churn Impact Estimator →
FAQ
What does this tool tell you?
The Cognitive Complexity Reference covers SonarSource cognitive complexity scoring rules, nesting increments, structural increments, and comparison with cyclomatic complexity.
What affects the result most?
Cognitive complexity (SonarSource): measures difficulty to understand, not path count like cyclomatic. Nesting increment: each level of nesting adds +1 to the complexity of nested constructs. Structural increments: if, else if, else, ternary, loop, catch, switch, logical &&/|| sequences each +1.
How should I use the result?
Use this tool to orient quickly to the concepts, field names, or values you are about to look up in a full specification or vendor documentation. It summarizes the common cases; the authoritative source remains whichever standard or vendor doc defines the values themselves.
Related tools