Cyclomatic Complexity: Resharper vs CodeMaid

I have been using CodeMaid and Resharper for a while now and noticed that they both calculate Cyclomatic Complexity. Although their calculation is always different, so I think their calculation logic does as well. But in your experience, which one is more accurate? It looks like Resharper is usually higher, but CodeMaid is easier to spot.

Perhaps one of them miscalculates this? Or otherwise, but acceptable?

Thanks in advance!

+3


source to share


1 answer


I can't talk to the CodeMaid implementation, but ReSharper is based on parsing the source code in an abstract syntax tree and actually building a control flow graph based on that information (this control flow graph is also used to parse a null value, keeping track of when things are null, rather than null or unknown, which allows for checks such as "possible NullReferenceException"). I would expect ReSharper to be an accurate calculation, but I don't know for sure.



That said, if the difference between the values ​​is fairly consistent, then it doesn't matter what the exact value is - as long as you know what the threshold means your code is too complex.

+4


source







All Articles