gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 207 forks source link

Show code coverage on pull request comment #198

Open btrajkovski opened 5 years ago

btrajkovski commented 5 years ago

Has anyone managed to achieve showing code coverage on the pull request for the new code?

This is a really useful feature for me because no issues combined with good coverage makes for a code PR and good code. Right now with this plugin, I can only show issues part. Having this kind of comment report would be very useful if its possible to show on a feature branch: https://github.com/gabrie-allaigre/sonar-gitlab-plugin/raw/master/doc/quality_gate.png

P.S. I am not sure if this is issue with the plugin itself of my setup. I am just looking for directions on how to implement this. Currently I am using this command:

           -Dsonar.host.url=${SONAR_HOST} \
           -Dsonar.login=${SONAR_USER} \
           -Dsonar.password=${SONAR_PASSWORD} \
           -Dsonar.analysis.mode=preview \
           -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA \
           -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME \
           -Dsonar.gitlab.project_id=$CI_PROJECT_ID \
           -Dsonar.gitlab.unique_issue_per_inline=true
           -Dsonar.gitlab.max_critical_issues_gate=-1

The version of the Gitlab plugin is 3.0 and Sonarqube version 6.3

byahia commented 5 years ago

You can do this by setting sonar.gitlab.all_issues to true. However it will comment with an overall status of your scan result (not only the newly added code lines).