C++ Coverage report not showing up in pull request

Hello, I am having problems with sonar-runner to present C++ code coverage results in SonarQube. I followed the steps to build with the build-wrapper and I used gcovr with --sonarqube to produce the coverage results. The coverage results are generated, because a file coverage.xml is generated with appropriate data (line numbers, etc).

The problem I am having is that the results, for a pull-request, are not properly uploaded to sonarqube. Sonar-runner is completing successfully and does sent an update to sonarqube, but no code coverage is visible. Also no files can be browsed and no code smells are found (see attachments). I double checked ofcourse that I did not exclude directories.

I was able to update the coverage results to the “master” branch, however for the pull-request there is no information, except for the last analysis time.

Can it be that sonarqube does not work if the “to be merged to” branch is still empty?

Versions used:

  • Sonar Scanner 4.2.0.1873,
  • SonarQube 8.0.0.29455
  • Build Wrapper 6.4 (linux-x86)
  • CMake 3.10.2
  • Gcovr 4.2

Hi @jeffrey,

in the screenshot it shows 72.6% estimated after merge, doesn’t it mean that it got some coverage information?

Yes I ran sonar-runner locally in the terminal (without branch information), thereby accidentally updating the statistics for the master branch. However since the master branch is protected from direct commiting, code is added via pull requests. It is for the pull requests that I do not get any statistics.

I validated that the build server and my local terminal are using the same version of sonar runner, the only difference is that on the build server branch and pullrequest id parameters are given to sonar-runner.

Can it be that the delta between the pull request and master is “zero” that causes nothing to show up? I would at least expect some code browsing possibilities.

Hi @jeffrey,

if the delta is zero between the two branches than it is expected to not see good results. You should try on a more realistic case.