Cannot pass Quality Gate but I have already added the file to sonar.exclusions

I am using the Github Pull Request analysis feature and my PR keeps failing the Quality Gate.

SonarCloud reports that my __mockdata__ file has too many duplications, even though I have already added sonar.exclusions=**/__mockdata__/* to my file to exclude the file. However, the file is still not being excluded.

Does anyone know why?

Can you give an example of a file path you’re trying to exclude? Do the files exist directly under the * mockdata* folder or in further sub-directories (which would require an exclusion like **/__mockdata__/**/*

the file path I am trying to exclude: /libs/ecommerce/src/client/dom/__mockdata__/
my exclusion is **/__mockdata__/*.


First things first, do you see the exclusion referenced in your scanner logs?

INFO: Project configuration:
INFO:   Excluded sources: <exclusion patterns>

Hi Colin,

How can I see the scanner log?

I forgot to clarify – are you using CI-based analysis or Automatic Analysis? If the latter, you should use a file rather than a file.

May I clarify the difference between CI-based analysis and automatic analysis? If my sonarcloud is triggered in Github and I don’t see any github actions for the analysis, can I confirm the analysis is an automatic analysis?

Yes, that’s a safe assumption. You can also check your projects’ Administration > Analysis Method.


I have added the following config to

Path to sources


Path to tests


Source encoding


Exclusions for copy-paste detection


But the quality gate still failed


Is this file at the root of your repository?