New to SonarCloud and trying to ignore test files from analysis


Just started using SonarCloud. I’ve set “Test File Exclusions” under “Analysis Scope” settings to “test/**/*” to ignore anything under /test at the root of our code base (and any subdirectories and files) but that doesn’t seems to work and I’m still getting a Quality Gate failed condition. Am I missing something?

Also is there any way to trigger a new analysis other than pushing a new commit to a branch?


Welcome to the community!

There are multiple parameters that control which files are analyzed and what is excluded. The most important are sonar.sources that define the directories of source files to analyze, and sonar.tests that define the directories of test files (we have different rules for sources and for test code).

I suspect that the /test folder is probably part of the sonar.sources. The Test File Exclusions setting applies to files that are part of sonar.tests.

See detailed explanation in the Narrowing the focus section of our online docs.

I hope you’ll be able to figure out the correct settings based on the above and our docs. If not, then please share all the relevant settings: sonar.sources, sonar.tests, and the other settings mentioned on the Narrowing the focus page.