Sonar exclusions not getting excluded in the quality gate analysis

Need help in getting one thing addressed regarding sonar exclusions.
There is one yaml file which is having this task.

      - task: SonarCloudPrepare@1
        inputs:
          SonarCloud: 'sonarcloud'
          organization: ''
          scannerMode: 'MSBuild'
          projectKey: '$(PROJECT_KEY)'
          projectName: '$(PROJECT_NAME)'
          projectVersion: '$(TAG_DETAILS.tagName)'
          extraProperties: |
            # Additional properties that will be passed to the scanner, 
            # Put one key=value per line, example:
            sonar.branch.name=$(branch.branchName)
            sonar.exclusions="$(var_SONAR_EXCLUSIONS)"
            sonar.coverage.exclusions="$(var_SONAR_EXCLUSIONS)"


we are passing sonar exclusions like this.
value of var_sonar_exclusions is like this:
/.sql,SdData/.sql,SdData/*,/.DbMigrate/,/.Tests/,/.TestDoubles/,/.TestHarness/,/.Database/.sql,**/*.Tests/Tests

But still the sql files are not getting excluded from the sonar coverage.

Also we need to exclude some .cs files which is present in one folder in the associated repo.

Please let us know how we can achieve this by passing this regular expression in the variable which we have created for sonar exclusions.

Hi,

Welcome to the community!

I suspect your variable isn’t being interpolated like you think it is. You can add sonar.scanner.dumpToFile=[path to file] (docs) to see exactly what key/value pairs analysis receives.

 
HTH,
Ann