问题描述
已在从Sonarqube 6.2版开始,覆盖率报告已合并,不再有单独的单元和集成覆盖率报告。
It has been cleared here that from Sonarqube version 6.2 that coverage reports are merged and there won't be separate unit and integration coverage report anymore.
我们仍然希望拥有这两项覆盖率报告分开。因此,我们有三个声纳项目:单元测试,集成测试,整个项目(负责创建总体覆盖率报告)
We still interested to have these two coverage reports separately. So, We have three sonar projects: unit-tests, integration-tests, whole-project(which is responsible to create overall coverage report)
问题:所有源文件都是在所有三个项目中进行了分析。由于文件数量太多,因此需要几分钟来执行分析。
Problem: All source files are analysed in all three projects. Since the number of files are too many, it takes several minutes to perform the analysis.
问题:是否可以在项目中以某种方式关闭声纳问题分析仪?希望仅报告前两个项目(单元测试和集成测试)中的测试覆盖率,而不分析所有文件,然后仅对最后一个项目(整个项目)运行问题分析器。它可以帮助我们分析所有文件一次而不是三次。
Question: Is it possible to turn off sonar issue analyser somehow in a project? It is desired to report only test coverage in the the first two projects(unit-tests & integration-tests) without analysing all files, and then run the issue analyzer only on the last project(whole-project). It could help us to analyse all files once instead of three times.
其他信息:我们使用声纳gradle插件版本2.6.2和声纳版本7.4
Additional info: We use sonar gradle plugin version 2.6.2 and sonarqube version 7.4
推荐答案
SonarQube / SonarCloud的主要职责是通知用户有关问题。显示代码覆盖率只是一个附加功能。这意味着没有标志/参数允许您执行此操作。
SonarQube/SonarCloud main responsibility is informing users about issues. Displaying code coverage is just an additional feature. It means there is no flag/parameter which allows you to do it.
幸运的是,有一种解决方法。您可以创建空的质量配置文件,并使用它们来扫描这两个项目(单元测试和集成测试)。您将收到0个问题,因为启用了零规则。
Luckily, there is a workaround. You can create empty quality profiles, and use them to scan those two projects (unit-tests & integration-tests). You will get 0 issues because there are zero rules enabled.
以下功能请求对您来说应该很有趣:。随时对其投票。
The following feature request should be interesting for you: Making test coverage measures mode useful. Feel free to vote on it.
这篇关于如何关闭声纳分析仪却仍然获得覆盖率报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!