Sonarqube exclusion not working

  • SonarQube Developer Edition Version 9.9 (build 65466)

  • SonarQube is deployed using ECS

  • I am trying to exclude certain path from sonarqube scanning. I have tried a few options but it did not work and I can still see files in those paths getting scanned in my CodeDeploy logs.

  • I am trying to exclude all files in the folder /foo/* and I have tried the following format in my Analysis scope setting under section 1. Global Source File Exclusions 2. Source File Exclusions 3. Coverage Exclusions 4. Duplication Exclusions

    **/foo/**/*.* (it did not work)
    **/foo/**/* (did not work)

If anyone has faced a similar issue or have suggestions for me try that would be much appreciated.

Hi,

Welcome to the community!

You should check your Project Setting → Background Tasks → [cog menu] → SonarScanner Context to see the exclusion values that were actually applied. Since the exclusions you’ve provided here should work, I suspect they’re being overwritten.

 
Ann

thanks for the suggestion. I checked SonarSacnner context and I could see it is reading the exclusion path but somewhere it is getting overwritten as I can see in the build log scanning for those exclusion path.

Any other suggestion to check for in the setting would be highly appreciated

Hi,

The overwrite is on your side. The docs should help you find it.

 
HTH,
Ann