Tools to automate calculation of cyclomatic complexity in java?

做~自己de王妃 提交于 2019-12-10 12:57:33

问题


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.


回答1:


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.




回答2:


One of the metrics produced by Sonar is Cyclomatic Complexity.
I believe it also has an Eclipse plugin (but I haven't managed to find it yet)




回答3:


AgitarOne from Agitar Technologies (http://www.agitar.com/solutions/products/agitarone.html) calculates cyclomatic complexity in their dashboard report and with their code rules plugin in Eclipse. Note also that McCabe IQ from McCabe Software (http://www.mccabe.com), a sister company of Agitar Technologies, also calculates cyclomatic complexity (aka McCabe complexity) for Java and has an Eclipse plugin for project setup.



来源:https://stackoverflow.com/questions/12355783/tools-to-automate-calculation-of-cyclomatic-complexity-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!