sonar.inclusions

3,674 views
Skip to first unread message

nup

unread,
Aug 7, 2017, 4:39:37 PM8/7/17
to SonarQube
Hi,

I have various folders that has .js fies that I would like to scan. 

Example: /folder1/test.js
               /folder1/mail.js
              /folder1/js/google.js

Is there a way to cheery pick those files for sonar scan using sonar.inclusions file ?

Any feed back would be greatly appreciated. 


Thanks

G. Ann Campbell

unread,
Aug 8, 2017, 7:45:15 AM8/8/17
to SonarQube, npir...@gmail.com
Hi,

That should absolutely be possible, although there's no sonar.inclusions "file". I always recommend setting inclusions and exclusions through the UI, but this can be done as part of your analysis properties.

Since you're asking, I guess you've already tried this and had problems?


Ann

nup

unread,
Aug 8, 2017, 7:37:07 PM8/8/17
to SonarQube, npir...@gmail.com
Hi Ann,

Thank you for you for you feed back. I used sonar.properties with sonar.inclusions=** /folder1/*.test.js,**/folder1/*.mail.js etc. I have tried testing different ways from the wildcards rule below, but had no luck.  I have about 40 files that need to be in sonar.inclusions. I know there are lots of files and perhaps this may not be the best way to do it, but still like to to try.  I am using SonarQube LTS 5.6.

Any suggestion would be greatly appreciated. 

Thank you,

----
Wildcards

Following rules are applied:

*Match zero or more characters
**Match zero or more directories
?Match a single character

G. Ann Campbell

unread,
Aug 9, 2017, 7:31:25 AM8/9/17
to nup, SonarQube
Hi,

First, you mention using sonar.properties so I just want to verify that you're not using Maven or Gradle for build and analysis...?

Could you try dropping the settings from sonar.properties and setting a single pattern via the UI to see what happens?


Ann


---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

nup

unread,
Aug 10, 2017, 12:13:44 PM8/10/17
to SonarQube, npir...@gmail.com
Hi Ann, 

I am not using Maven or Gradle, but as per your suggestion i added inclusions and exclusions in UI and it worked. I guess there is less room for error when you use UI. 

Thank you so much for all your help!

Colin Mueller

unread,
Aug 12, 2017, 5:50:34 PM8/12/17
to SonarQube, npir...@gmail.com
Hey Ann,

I'm curious why you recommend this be done in the UI. I generally tell teams in my organization to use a sonar-project.properties file so that there's a history in source control about changes to the settings.

G. Ann Campbell

unread,
Aug 14, 2017, 7:36:43 AM8/14/17
to Colin Mueller, SonarQube, np
Hi Colin,

I recommend using the UI for this because in general settings in this category can be tricky to get right using hand-written properties.


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/Q6G8PbMGrLA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/db558d86-7612-45cf-a085-79b1a7188b69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages