1

I already went through : Configure Sonar to exclude files from Maven pom.xml and still SonarLint is unable to execlude those all files.

Any help is much appreciated

<properties>
    <java.version>1.8</java.version>
    <sonar.coverage.exclusions>
        **/dto/**/*, **/entity/**/*,
        **/exception/**/*, **/repository/**/*,
        **/enums/**/*, 
        **/assembler/**/*, 
        **/src/main/resources/sql/**/*,
        **/controller/**/*,
        **/utils/**/*, 
        **/security/**/*,
        **/servlet/**/*,
        **/MainApplication.java
    </sonar.coverage.exclusions>
    <sonar.exclusions>
        **/entity/**/*, 
        **/constant/**/*,
        **/repository/**/*, 
        **/src/main/resources/sql/**/*, 
        **/enums/**/*
    </sonar.exclusions>
</properties>
Jeff Cook
  • 7,956
  • 36
  • 115
  • 186

1 Answers1

0

Follow this procedure to exclude the files: Click on your project name in SonarQube -> Administration -> General Settings -> Analysis Scope -> Coverage Exclusions OR Source File Exclusions (You can put the file pattern in the text box)

This will skip the files which matches the given pattern.

  • will it not work if we provide the package list in build script? I tried the same from gradle build for coverage exclusions, but still sonar shows in those classes in the report. – San Jan 21 '21 at 13:54