Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Project administrators can select which quality profile to use for each language on their project. Go to Configuration > Quality Profiles:

Excluding Files

It is possible to exclude files from being analyzed. Go to Configuration > Settings > Exclusions and set the sonar.exclusions property.

Since version 3.3, it is also possible to:

...

Set

...

Exclusions

...

 

Info
titleCoding rules

If you want to exclude source code from being check against some coding rules, you can have a look at the Switch Off Violations plugin.

Since version 3.5, it is also possible to:

  • Set the files to be analyzed through the sonar.inclusions and sonar.test.inclusions properties. In this case, only these specific files will be analyzed.
  • Exclude some files from being checked against duplications. To do so, set the sonar.cpd.exclusions property (Configuration > Settings > Duplications).

There are two different ways to exclude/include files: using fully a qualified name or an absolute path. A fully qualified name should be used whenever possible.

Fully qualified name of the component (see red frames below):
Image Removed

For Java only, replace '.' package separator by '/' and add '.java' extension.

Code Block
titleExamples
languagebash
# Exclude all classes ending by 'Bean'
# Matches org.sonar.api.MyBean.java, org.sonar.util.MyOtherBean.java, org.sonar.util.MyDTO.java, etc.
sonar.exclusions=**/*Bean.java,**/*DTO.java
 
# Exclude all classes in the 'org.sonar' package
# Matches org.sonar.MyClass.java, org.sonar.MyOtherClass.java
# But does not match org.sonar.util.MyClassUtil.java
sonar.exclusions=org/sonar/*.java
 
# Exclude all classes in the 'org.sonar' package and its children
# Matches org.sonar.MyClass.java, org.sonar.MyOtherClass.java, org.sonar.util.MyClassUtil.java
sonar.exclusions=org/sonar/**/*.java

...

Absolute path: relative path must be used whenever possible

Code Block
titleExamples
languagebash
# Exclude all the java classes contained in a src/generated/java directory and its subdirectories
sonar.exclusions=file:**/src/generated/java/**/*.java

See Narrowing the Focus.

Customizing Links

To add links to your project, click on Links in the left menu:

...