Versions Compared

Key

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

...

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

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

    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 *.cs files included in /path_to_my_project/myProject/src/generated and its subdirectories
    sonar.exclusions=file:/path_to_my_project/myProject/src/generated/**/*.cs
     
    # Exclude all the java classes contained in a src/generated/java directory and its subdirectories
    sonar.exclusions=file:**/src/generated/java/**/*.java
    

...