sonarqube-community-branch-plugin
sonarqube-community-branch-plugin copied to clipboard
Disable code coverage report on Gitlabci
Describe the bug
Disable the coverage pushed to gitlab, as it is sometimes not correct and gitlab already provides this feature.
Expected behavior
It wold be nice to be able to disable the coverage pushed by the plugin through a specific property.
Additional context
As we already use the coverage through gitlab (more complete, showing which lines are covered or not), the sonar gitlab is a pain to set and never seem to be correct. We would like to disable it entirely when it's pushed to gitlab.
If this is somzthing you would consider, I can work on a PR
@Glosur, what you mean about disabling coverage pushed to gitlab?
Is the coverage provided by the external job created by the plugin?
If so, I agree with you because the final coverage displayed on the MR page will be incorrect since it will show the average coverage between my test and the coverage of the new code.
For example, if I have one MR with only 1 changed line that doesn't is covered by tests, the widget will report an incorrect coverage of (test coverage + sonar coverage) / 2
:
Yes, we are having the problem you're saying, that is heavily linked with https://github.com/mc1arke/sonarqube-community-branch-plugin/pull/225
We use another gitlabci job to get the covergae from. Gitlab then also receives the coverage from the sonar plugin (the coverage is not the correct one, see PR linked)
In the end, even if the PR is fixed, I have to maintain two tools to have the coverage in the gitlabci job matching the one in sonar
Even with #225 merged we are having this problem as well.
I just ran an analysis with sonarqube 9.5 and with plugin version 1.12.0 and the reported coverage in the SonarQube external job is the new code coverage and not the total coverage.
Hi @mc1arke
Regression to #225 was made in this change: https://github.com/mc1arke/sonarqube-community-branch-plugin/pull/577#pullrequestreview-1349778894
The coverage send back via the GitLab API should be the total coverage of the project, not the coverage of the new code in the PR.
Best regards, Mateusz
I just came across this issue having the same problem as you.
Sonarqube Community Edition Version 9.8