Home / Companies / Sonar / Blog / Post Details
Content Deep Dive

Cognitive Complexity, Because Testability != Understandability

Blog post from Sonar

Post Details
Company
Date Published
Author
G. Ann Campbell
Word Count
1,069
Company Posts That Month
3
Language
English
Hacker News Points
-
Post removed?
No
Summary

SonarSource is introducing `Cognitive Complexity` as an alternative to `Cyclomatic Complexity`, which measures testability, but not maintainability. Cognitive Complexity aims to provide a fair representation of how difficult control flow in a method is to understand and maintain. It increments for structures that break the linear flow of code, nesting, and ignores "shorthand" structures. The new metric is designed to incent good coding practices by penalizing complex constructs and ignoring readable ones. Cognitive Complexity will be added as a method-level rule in mainline languages, initially starting with Java, JavaScript, C#, and C/C++/Objective-C, with the goal of eventually adding class/file-level rules.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.