简体   繁体   中英

SonarQube fails on comment % while calculated ratio is >26%

I have been using sonar for over 4 years for Java projects we have created.


Currently, we want to fail the build if some metrics cannot be met. Thus, I installed Build Breaker plugin and re-run the build cycle, without any issue. Then I modified quality gates to contain "'Comments (%)' rule to for 'is less than' check of '20' ( threshold for warning), '10'( threshold for error) " as attached in:

质量门截图

However, after those definitions the projects failed to build. Although all files seem to have enough comment (from 28 % to 77 %) , as in image below,

每个Java文件的注释率百分比

While in main screen it is shown as 0%

摘要画面

I could not find any log, comment or information on how this can happen (in sonar.log or mvn -X ) and as far I searched , no one encountered this issue.

Did anyone encountered this problem, or have any idea why this can occur? My SonarQube version is 5.6.7, Build Breaker version is 2.2 (downloaded from github), maven version is 3.0.5 and JDK 8.

When defining your Quality Gate, you selected the option "over leak period". So what counts the variation of the % of comments in your current leak period, which is the version 1.4.1.

What you see in the screenshot with the perc. of comments per file is the absolute measure.

You might want to uncheck the option "over leak period".

Note that the way measures are displayed was improved in later versions of SonarQube.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM