Help with scanning only specific files in specific folders

Hello. I’m using yamls within Azure DevOps pipelines. I’m trying to set up scanning so that it scans files with “.service.” in the name and only files of that name is a specific subfolder called “critical”. Currently it fails on code coverage even if there are no files to scan for coverage. I’m not sure if what I’m attempting is even possible but it was requested by the developer leading the project. Below is how I currently have my prepare task set up (with org specific info changed.)

- task: SonarCloudPrepare@3
  condition: eq(variables[‘SonarScan’], ‘true’)
  inputs:
 SonarCloud: ‘Sonarcloud’
 organization: ‘org’
 scannerMode: ‘dotnet’
 projectKey: ‘projkey’
 projectName: ‘projname’
 extraProperties: |
  sonar.exclusions=/*.cs
  sonar.inclusions=
/Critical/**/*.cs

Hi,

Let’s start with this part. Have you gotten it working? And is that *.service files in addition to **/Critical/**/*.cs files?

No need to do both of these. An inclusion implicitly excludes what’s not… included.

I don’t understand. By including the *.cs files located anywhere under a Critical directory, then you certainly have “files to scan for coverage”.

 
Ann