Failed to exclude during SonarQube code analysis third party source mentioned in Cobertura report

Hello,

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:

# Exclude external references:
sonar.coverage.exclusions=**\commandtypeslib\**\*, **\configurationtypeslib\**\*, **\distributedloggingtypes\**\*, **\source_subfolder\**\*, **\vctools\**\*, **\externalapis\**\*, **\connextdds\**\*

I confirmed that the settings are in effect by looking at the log file

12:01:59.137 INFO:   Excluded sources for coverage: **\commandtypeslib\**\*, **\configurationtypeslib\**\*, **\distributedloggingtypes\**\*, **\source_subfolder\**\*, **\vctools\**\*, **\externalapis\**\*, **\connextdds\**\*

however I am still getting the above warnings. Any suggestion on how to resolve this from the SonarQube configuration side will be appreciated.

Thx,

Simon-Pierre

Hi Simon-Pierre,

Those warnings are emitted during parsing of the coverage report, and they’ll continue to show up as long as the coverage report includes the library files. The way to get rid of the analysis log warnings (if that’s essential to you - you could just as easily ignore them) is to remove the files from the report.

 
HTH,
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.