issueatlas · · Reply permalink
yeah you can use both at the same time, they stack. inclusions decide what gets pulled into the analysis at all, then exclusions trim things out of that set. so you dont need to list every folder one by one.
a couple of things that might be biting you:
- the patterns are relative to the project base dir and theyre case sensitive. if the base dir is already the repo root,
Repo/Folder 1wont match anything. check the analysis logs for the actual base dir and try something likeFolder 1/**instead. - if the real issue is test files showing up in the coverage on the overview, sonar.exclusions is the wrong knob. that one removes files from analysis completely. to keep test code out of the coverage numbers you want sonar.coverage.exclusions, with patterns matching your test project folders.
also make sure the properties are set in the prepare analysis step of the ADO pipeline, before the build and scanner end step. coverage exclusions are probably your actual fix here.
Source: https://community.sonarsource.com/t/using-sonar-inclusions-and-exclusion/188697