How can one turn off sonar analyser but still get

2019-08-23 12:14发布

问题:

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.

Additional info: We use sonar gradle plugin version 2.6.2 and sonarqube version 7.4

回答1:

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.

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.