Tools to automate calculation of cyclomatic complexity in java?

mjgpy3 picture mjgpy3 · Sep 10, 2012 · Viewed 8.7k times · Source

Are there any tools available for Java that can automagically determine the cyclomatic complexity of given Java code? I have sought out tools online, and have yet to find one.

Answer

Domenic D. picture Domenic D. · Sep 10, 2012

I use Sonar (my preferred method). There are plugins to "automagically" generate the report at build time (i.e. ANT/Maven, etc...).

Another related post on how to show the CC on the dashboard: how to list methods with most cyclomatic complexity

One other tool I've used in the past is corbetura. You have to have good unit tests though and finding the quantitative analysis for CC is a little tricky.