Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude generated code in sonar

How to exclude generated code from sonar processing and reporting?

I tried to exclude **/*generated* but packages like org.blayo.generated are still in report:

<plugin>
  ...
  <artifactId>maven-checkstyle-plugin</artifactId>
  <configuration>

    <excludes>**/*generated*</excludes>

Edit: The right regular expression was **/generated/*.java

like image 834
Philippe Blayo Avatar asked Dec 04 '12 14:12

Philippe Blayo


People also ask

How do you exclude in Sonar?

To use exclusions to analyze only the specified subset(s) of files in sonar. sources , go to Project Settings > General Settings > Analysis Scope > Files. You can set these properties at both the project and global levels.

How do you exclude rules in SonarQube?

You can not modify the built-in profiles. If you don't see the option of Deactivate, then copy the profile and set it as default. Now you will see the options to activate/deactivate. Show activity on this post.


1 Answers

The exclusion pattern has changed since SonarQube 3.5. Here is how it works now:

<properties>
   <sonar.exclusions>file:**/generated-sources/**</sonar.exclusions>
</properties>

Source: SonarQube JIRA

like image 172
Pith Avatar answered Oct 24 '22 05:10

Pith