Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube - Exclude a set of specific files

I am using Sonar in a Angular Application for the front part.

I have many js files in my application, but i need that the Sonar ignore or exclusion my js files that ending in .spec.js, are tests unit of Angular.

I have many folders under "src/app" and inside i have many folders with the .spec.js files .

In the properties file to Sonar (sonar-project.properties), I think I can use:

sonar.test.exclusions=src/app/*.spec.js

or

sonar.exclusions=src/app/*.spec.js

But I'm not sure, in what format is the value of property.

Thanks,

like image 569
Eladerezador Avatar asked Jan 05 '23 07:01

Eladerezador


1 Answers

Yes, you are correct. You can use the sonar.exclusions property to exclude source files from analysis and the sonar.test.exclusions property to exclude unit tests. You should pass a comma-delimited list of file path patterns to these properties.

I suggest you refer to this topic to learn how to specify path patterns. Say, if you need to exclude all the .spec.js files from all the src/app directories, use this pattern:

**/src/app/*.spec.js
like image 193
Pasick Avatar answered Jan 14 '23 07:01

Pasick