简体   繁体   English

当项目不运行时,不会触发最重要突变的质量门

[英]quality gate on pitest mutations is not triggerd when project does not run pitest

we are using pitest plugin in sonarqube and set up a quality gate on mutation coverage, since it is much more valuable than other coverage measurements. 我们在声纳分析仪中使用了pitest插件,并为突变覆盖率设置了质量门,因为它比其他覆盖率测量更有价值。 Only, when a project is pushed that does not use pitest, the quality gate is not triggerd at all. 仅当推送不使用pitest的项目时,根本不会触发质量门。 Is it possible to define a quality gate to detect that pitest is not defined for a project at all? 是否可以定义一个质量门来检测根本没有为项目定义坑? Thank you 谢谢

Simple answer to your question: no, it's not. 您问题的简单答案:不,不是。 Quality gate conditions can not be triggered by the absence of a metric. 缺少度量标准无法触发质量门条件。 So a metric has to be computed. 因此,必须计算一个指标。 But the most recent version of sonar-pitest-plugin (0.9) does only compute coverage information when Mutation Analysis data is present (= a pitest report exists). 但是,最新版本的sonar-pitest-plugin(0.9)仅在存在突变分析数据(=存在最严重的报告)时才计算覆盖率信息。

The change however is not overly complicated, if you need an urgent fix, check the PitestComputer class at line 84 and add the following else block: 但是,更改并不太复杂,如果需要紧急修复,请在第84行检查PitestComputer类,并添加以下else块:

if (mutationsTotal != null) {
  ...
} else {
   context.addMeasure(PitestMetrics.MUTATIONS_KILLED_PERCENT_KEY, 0.0);
}

Compile it and install it manually to your instance. 编译并将其手动安装到您的实例。

That said, I want to give you a short heads up, that there is a newer plugin addressing Mutation Analysis in SonarQube (full disclosure: I'm the author), with several new features, rules etc. 就是说,我想告诉您一个简短的提示,在SonarQube中有一个更新的插件可以解决突变分析(完全公开:我是作者),其中有几个新功能,规则等。

The plugin is available via the market place (named "Mutation Analysis"). 该插件可通过市场(名为“突变分析”)获得。 The plugin has the same limitation as the sonar-pitest-plugin, but I just created a new issue addressing your problem: 该插件与sonar-pitest-plugin具有相同的限制,但是我刚刚创建了一个新的问题来解决您的问题:

https://github.com/devcon5io/mutation-analysis-plugin/issues/13 https://github.com/devcon5io/mutation-analysis-plugin/issues/13

Edit: This feature is implemented in version 1.3 编辑:此功能在版本1.3中实现

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

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