How to exclude JavaScript source files from sonarqube analysis? - Stack Overflow

Hello sonarqube experts,I am running sonarqube 5.2 server and JavaScript plugin v.2.13. I would like t

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 pletely 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?

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 pletely 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?

Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Dec 13, 2016 at 15:32 user2299739user2299739 231 gold badge1 silver badge6 bronze badges 3
  • Possible duplicate of SonarQube 4.3.2 Javascript exclude – Maximilian Peters Commented Dec 13, 2016 at 15:43
  • My question contains the solution cited in stackoverflow./questions/25112543/… . However, it doesn't work for me. This is exactly what my question is - why the pattern [*/aFolder/.js] does not work? – user2299739 Commented Dec 13, 2016 at 15:49
  • Could it be a pattern issue? What if you try with sonar.exclusions=**/*.js or sonar.exclusions=**/notMyCode/**/*.js – Julien H. - SonarSource Team Commented Dec 15, 2016 at 10:42
Add a ment  | 

2 Answers 2

Reset to default 1

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.

In sonarqube go to project settings-->General settings-->Analysis scope-->source file exclusions. example to exclude js files : **/*.js

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745108836a4611722.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信