Hello sonarqube experts,
I am running sonarqube 5.2 server and JavaScript plugin v.2.13. I would like to exclude some of the JavaScript code that is third party library (jQuery, for example) from my analysis. how can I do this? I tried something like this:
sonar.module= myModule
myModule.sonar.sources=srcFolder
myModule.sonar.exclusions=**/notMyCode/*.js
I can see in the log the exclusion filter is being picked up:
Excluded sources: =**/notMyCode/*.js;
but then it appears to be ignored as all the files are analyzed anyway:
101 files indexed
0 files ignored because of inclusion/exclusion patterns
I tried all possible exclusion patterns and nothing seems to work, even when I put it this way:
sonar.exclusions=*.js
This should exclude all javascript files but the exclusion filter is being completely ignored.
just found out by trial and error that the exclusion patterns work if "global" qualifier is used. for example the following works as expected:
sonar.global.exclusions=**/notMyCode/*.js;
while this one doesn't:
myModule.sonar.exclusions=**/notMyCode/*.js;
is this expected behavior?
This is invalid:
sonar.module= myModule
You probably meant to write this (plural "modules"):
sonar.modules = myModule
The use of sonar.modules
is demonstrated in several examples in the documentation.
With this correction, the exclusions should work as expected,
both global and project-specific.
Also make sure that you're using the correct glob pattern, as explained here.
Finally, in your last examples you used a terminating ;
at the end of lines, for example myModule.sonar.exclusions=**/notMyCode/*.js
, you should remove those.