using, sonarqube-9.4.0.54424 developer edition and sonar-scanner-4.7.0.2747-windows
My project is having C, C++ languages. I am able to run sonar-scanner and results are shown on dashboard using build-wrapper-win-x86.
But the coverage is showing zero.
I am using googletest for unit test cover and creating code coverage report in cobertura (xml) formal using OpenCppCoverage.
I tried above things but for 1st line throwing parsing error and remaining lines are not reflecting in logs.
ERROR: Error during SonarScanner execution
ERROR: Error during parsing of the generic coverage report 'C:\REPO\ctestCoverage.xml'. Look at SonarQube documentation to know the expected XML format.
ERROR: Caused by: Unknown report version: 0. This parser only handles version 1.
Is there any way to support cobertura xml for c++ project or any option to generate sonar supported report using OpenCppCoverage?
Thank you for the report, I have checked OpenCppCoverage, and the tool support exporting in Cobertura and internal binary format. We currently do not support importing either of them.
One possibility would be to convert them into the generic coverage format and provide a path to the report as sonar.coverageReportPaths. Note that this property accepts reports in this format. Providing a report in another format will cause an error that you are encountering, so you should remove this line unless the report format is transformed.
Regarding other options:
sonar.cobertura.reportPath is not recognized by our analyzer and seems to be used by following thirdParty plugin.
sonar.flex.cobertura.reportPaths applies only to code in the Flex language and it does not apply for C++ code
I am passing a code coverage report generated by OpenCppCoverage [0.9.9.0] to SonarQube 10.2. The report contains references to Windows external 3rd party libraries as I didn’t make use of the --excluded_sources command line parameter.
E.g. 12:02:05.860 WARN: Cannot resolve the file path ‘j\c3ipr\pr_1860_3_12_9.short\6625a0\1\source_subfolder\libs\filesystem\src\codecvt_error_category.cpp’ from the Cobertura coverage report
In order to prevent these kinds of warnings and avoid third party source code to be taken into consideration into the code coverage percentage I defined in sonar-project.properties the following property following the syntax as per the ignore-code-coverage page: