how to list methods with most cyclomatic complexit

2019-07-16 13:13发布

I have installed sonar 2.12. Going to Violations > Major > Cyclomatic Complexity I can see the number of methods with CC over 10, but I need to go method by mehod to see its actual CC. I wonder if there a way to see a list of the methods with most CC?

标签: sonarqube
3条回答
Summer. ? 凉城
2楼-- · 2019-07-16 13:36

Our tool, SourceMeter has a plug-in for SonarQube that can list the most complex methods. It provides widgets for method level metrics. You can check it out here.

查看更多
The star\"
3楼-- · 2019-07-16 13:42

With Sonar 2.12, you can customize the dashboard of your project (with admin rights) in order to display the "metric hotspot widget" which you can configure to display the cyclomatic complexity metric. This way, you will see the highest CC of your project.

Read more on how to customize your dashboard.

查看更多
Evening l夕情丶
4楼-- · 2019-07-16 13:50

There should be a rule to check for methods with high complexity; configure the threshold and run your analisys.

Then use Sonar REST api to query for hits of that rule. The result will include filename, line number and the message will tell you complexity value.

This is the operation you will have to invoke: http://docs.codehaus.org/pages/viewpage.action?pageId=229743298

查看更多
登录 后发表回答