[英]Is it possible to create a sonarqube quality gate condition to catch reduction in the code coverage in latest sonarqube(Version 6.7)?
I need to create a sonarqube quality gate condition that fails a build if the code coverage drops from the last version. 我需要创建一个声纳质量门条件,如果代码覆盖范围从最新版本下降,则该条件将使构建失败。 The leak period is now set as the 'previous_version'. 现在将泄漏时间设置为“ previous_version”。 I know that there was a delta analysis feature in the older versions of sonarqube. 我知道旧版本的sonarqube具有增量分析功能。 But I think this is no longer available. 但是我认为这不再可用。
For example, in the previous build the coverage was 30% and in the current build it is 29%. 例如,在以前的版本中,覆盖率为30%,在当前版本中为29%。 So there is a drop in the overall coverage. 因此,总体覆盖范围有所下降。 In this case I need to fail the build. 在这种情况下,我需要使构建失败。 Again I cannot do absolute comparison(like Coverage < 30 etc.) because the coverage varies in different projects and I am doing a global configuration. 同样,我无法进行绝对比较(例如Coverage <30等),因为Coverage在不同项目中会有所不同,并且我正在进行全局配置。
I am using sonarqube 6.7 LTS Community version 我正在使用sonarqube 6.7 LTS社区版本
Is this even possible? 这有可能吗? If not is there a different way? 如果没有,还有其他方法吗?
I guess I found a way around this. 我想我找到了解决方法。 I setup a rule like this in the quality gate: 我在质量门中设置了如下规则:
and added more code to the project without tests. 并在没有测试的情况下向项目添加了更多代码。
Then I ran the analysis and my quality gate failed with following message: 然后,我运行了分析,但质量门失败并显示以下消息:
(Ignore the coverage on new code rule on the left) (忽略左侧新代码规则的内容)
I think the key here was to set the "Over leak period" checkbox ticked 我认为这里的关键是要选中“溢出期间”复选框
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.