简体   繁体   English

SonarQube的评论%失败,而计算的比率> 26%

[英]SonarQube fails on comment % while calculated ratio is >26%

I have been using sonar for over 4 years for Java projects we have created. 对于我们创建的Java项目,我使用声纳已有4年了。


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. 因此,我安装了Build Breaker插件并重新运行了构建周期,没有任何问题。 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: 然后,我修改了质量门,以包含以下内容的“评论(%)”规则,即“小于”检查“ 20”(警告阈值),“ 10”(错误阈值)。

质量门截图

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, 尽管所有文件似乎都具有足够的注释(从28%到77%),如下图所示,

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

While in main screen it is shown as 0% 在主屏幕上显示为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. 我找不到任何日志,评论或如何发生这种情况的信息(在sonar.log或mvn -X中),到目前为止,我进行搜索时,没有人遇到此问题。

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. 我的SonarQube版本是5.6.7,Build Breaker版本是2.2(从github下载),maven版本是3.0.5和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. 那么,什么才算当前泄漏期间(版本1.4.1)中注释百分比的变化。

What you see in the screenshot with the perc. 您在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. 请注意,在更高版本的SonarQube中改进了显示度量的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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