Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cyclomatic complexity, how much is too much?

Just wondering, I have installed CodeMaid for Visual Studio and getting code quality stats on a large codebase. i see numbers ranging from 1 to 300 on many of the methods. How much is too much? Can we (or should we) even have a threshold for something like this?

like image 396
Ahsan Avatar asked May 26 '15 02:05

Ahsan


1 Answers

Exact number is team/personal opinion based, but 100+ is definitely way too high.

Microsoft's recommendation is 25:

CA1502: Avoid excessive complexity

The rule reports a violation when the cyclomatic complexity is more than 25.

like image 77
Alexei Levenkov Avatar answered Sep 21 '22 12:09

Alexei Levenkov