Should we prefer cognitive complexity over cyclomatic complexity?

Hi,

That’s just how Cyclomatic Complexity works. Remember, I said that Cyclomatic complexity is about testability. To thoroughly test your class you need at least one test case for each method, and that’s what’s being reflected in that “scores 1 for a function”.

But your perception that it “heavily distorts reality” is quite common among developers and one of the things that lead us to formulate Cognitive Complexity.

 
Ann