SimonKagstrom / kcov

Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options
http://simonkagstrom.github.io/kcov/
GNU General Public License v2.0
710 stars 109 forks source link

SonarCloud Integration #374

Open TobiasDuswald opened 2 years ago

TobiasDuswald commented 2 years ago

Dear developers,

the project description points out that kcov supports the integration with SonarSource products, specifically with SonarCube. The documentation for this feature is rather basic and given in this file. The referenced plugin is officially deprecated. I wondered if you know if it's possible to use kcov in combination with SonarCloud which belongs to the same family of products of the same company? The instuctions file above mentions a file sonarqube.xml that should appear in the output but if I run kcov on our project this file does not appear. Are there specific options that must be used to create that file?

Sorry the question is not as structured as I'd like it to be but any help in the direction of using kcov's output for SonarCloud's coverage would be much appreciated.

Thank you very much!

Tobias

SimonKagstrom commented 2 years ago

I haven't used SonarCube for the last couple of years, so that support has probably rotted away.

Looking at your link, it appears to support cobertura output through

sonar.flex.cobertura.reportPaths

and kcov generates cobertura XML in path/to/output/binary/cobertura.xml

This is probably the way to go for SonarSource / SonarCloud support.

Edit: Assuming it works for other languages than Flex.

TobiasDuswald commented 2 years ago

Dear @SimonKagstrom, I gotta apologize - I somehow missed the presence of the sonarqube.xml in kcov's output directory. It's indeed still there and the output format has not changed over the past years, i.e. your sonarcube.xml format is perfectly well understood by SonarCloud. So for other kcov users using SonarCube / SonarCloud, it's sufficient to direct SonarCloud to the sonarcube.xml file, e.g. specify

# Coverage reports
sonar.coverageReportPaths=build/coverage/coverage_data/sonar_coverage.xml

with the path suitably modified. We introduced coverage reporting in PR 247 of our repository. Maybe that is helpful.

Thanks again for your help Simon!

SimonKagstrom commented 2 years ago

Good to hear!

I guess the documentation needs some updating though :-). I'll try to come up with something based on your comment above