Sonar.coverage.exclusions union of project/commandline

I know that you can add files/folders from code coverage exclusions, by sending this sonar.coverage.exclusions to the analyzer.

However if you have some exclusions on the project settings, this settings seems to override the project settings, and not doing a union of the exclusion provided by project settings/commandline

is it somehow possible to reference the existing exclusions on project level in the commandline and append to them. something in the lines of


Hello @Ligtorn,

Welcome to the SonarSource community. :wave:. Hope you’ll enjoy it

What you’re asking is not possible and it does not seem very useful to implement.
You should decide on your policy: Either you set your exclusions on the server side, or on the client side, but not on both. If you set both, the client (scanner) side, supercedes the server side, as you noticed.

And normally I would say that it’s better to set the exclusions on the scanner side. These parameter are typically stored in the repository (either in or in the pipeline description file (JenkinsFile, YAML, you name it)). This is the best place to be to keep the exclusions in good sync with the code.


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