Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excluding java files in sonar report through Jenkins [closed]

I am running sonar from Jenkins. I want to exclude some java files in the sonar report. Is that possible through Jenkins? If yes, how can I do that?

like image 200
vinod Avatar asked Jan 13 '12 09:01

vinod


People also ask

How do I exclude files from sonar coverage?

You can prevent some files from being taken into account for code coverage by unit tests. To do so, go to Project Settings > General Settings > Analysis Scope > Code Coverage and set the Coverage Exclusions property. See the Patterns section for more details on the syntax.

What is sonar coverage exclusions?

sonar.exclusions will exclude mentioned files or directories from analysis. sonar.coverage.exclusions still exists and will exclude mentioned files or directories from code coverage like in question asked. But it's not mentioned in current documentation.

What is the difference between sonar coverage exclusions and sonar exclusions?

coverage. exclusions excludes some files from the test coverage metrics but those files are still analyzed: other metrics, duplications, coding rules... sonar. exclusions completely excludes some files from the analysis: those files don't appear at all in SonarQube.


2 Answers

Assuming you are using jenkins sonar plugin, refer to this documentation on how to configure the plugin to specify additional parameters which allow files to be excluded from analysis.

like image 76
Raghuram Avatar answered Oct 08 '22 01:10

Raghuram


Just pass the "sonar.exclusions" property to your build (for instance using a JVM argument "-Dsonar.exclusions=**/Foo.java").

like image 33
Fabrice - SonarSource Team Avatar answered Oct 07 '22 23:10

Fabrice - SonarSource Team