wenns/sonar-cxx — pull request #221 by javier-pse (2014-05-30 10:20:40+00:00)
Title: Report zero coverage for all files not found in the coverage report

I found that the plugin does not report any coverage statistics for any file which has no measurements in the XML coverage report. This is causing Sonar to report misleading results for me.

Take the following example:

code1.cxx (File 100% tested in my unittest)
code2.cxx (File not tested in the unittest. Therefore, it is not found in the coverage report)
Both files selected in "sonar.sources"

Results:

code1.cxx: 100% coverage
code2.cxx: ---
Overall coverage: 100%

100% overall coverage? This is misleading! There is one file that is not tested at all. Assuming that code1.cxx and code2.cxx have exactly the same number of statement, I would expect a 50% overall coverage.

Find here a patch that will fix this issue. It sets the line coverage to zero for any file found in "sonar.sources" but not in the coverage XML report.