Multiple scans to the same project

991 views
Skip to first unread message

donnib

unread,
Feb 2, 2018, 5:20:31 AM2/2/18
to SonarQube
Hi,

So i have following structure in our repository :

main/
├── ios/
│   ├── Visual Studio Project
├── pc/
│   ├── Visual Studio Project
├── shared/


We have two builds :

1. When changes to ios folder is made ios, shared get's build and then we run a Sonar scan and push to SonarQube project X
2. When changes to pc folder is made pc, shared get's build and then we run a Sonar scan and push to SonarQube project X

Above mean that depending when you look at SonarQube project X either ios or pc project is not analysed.

If i create a SonarQube project for each of these visual studio projects then i double the LOC lines counting towards our license which is unfair because shared project is counted twice and also all SonarQube issues on shared are separated between those two projects. 

So my question : What is the best practice to do this or is there a way that i can solve above problem ?

/donnib

G. Ann Campbell

unread,
Feb 2, 2018, 2:13:02 PM2/2/18
to SonarQube
Hi donnib,

Your best option is probably to analyze both projects separately and exclude 'shared' in one of those projects.

Since you're concerned about LoC, that means you at least have Developer Edition. So another option would be to analyze one of the versions as a long-lived branch under the other. As a reference, take a look at SonarQube's 6.7 in next. Branch lines aren't included in your LoC so that's actually a little "unfair" on our side. The disadvantage of this route is that long-lived branches aren't designed for this type of use, so you may experience some oddities, altho I can't think of anything off-hand.

 if you have Enterprise Edition, a third option would be to run 3 separate analyses: ios (excluding shared), pc (excluding shared), and shared. Then you can pull them back together as an Application.


HTH,
Ann

donnib

unread,
Feb 22, 2018, 4:39:12 AM2/22/18
to SonarQube
@Ann

I am trying to exclude our shared project from the analysis and not matter what i try it doesn't get excluded.

First of all it would be nice if i could exclude it from the msbuild sonarscanner run so i tried /d:sonar.exclusions="**/SXU.Shared/**/*" i also tried same thing on the WebUI for one of the projects (yes i did rerun the analysis after i changed this) but no matter what it doesn't get excluded. I would guess that if i did in inthe csproj file then it would work but then it won't get analysed at all in any of those sonarqube projects. Why is it so difficult so exclude something like this ? 

btw i also tried these 
  • Source/Shared/SXU.Shared/**/*
  • Source/Shared/SXU.Shared/**
  • **/SXU.Shared/*

G. Ann Campbell

unread,
Feb 22, 2018, 7:49:37 AM2/22/18
to donnib, SonarQube
Hi,

Exclusions are multi-value parameters and thus difficult to set correctly outside the UI, which is why you're having trouble. Try setting this up through the UI and you should get something closer to the result you want.


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/6lbmiVCpQ-A/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/32558432-de6f-4702-87f9-aaefeab9765d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

G. Ann Campbell

unread,
Feb 22, 2018, 2:35:31 PM2/22/18
to Mihai Marinescu, SonarQube
Hi,

Please remember to include the Google Group in your replies. :-)

Also, I've just realized that your question is completely unconnected to @donnib's original thread. Ideally you would have started a new thread for a new question.

But, you're right, you did say you tried setting your exclusion through the UI, and I missed that. So at this point, you should take a look at the paths to the files as SonarQube understands them and try using some variation in your exclusion.

If that doesn't work for you and you do need to come back again, please do so in a new thread.


Thx,
Ann





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

On Thu, Feb 22, 2018 at 7:57 AM, Mihai Marinescu <mi...@marinescu.dk> wrote:
Hi Ann, as mentioned i already tried that and no matter what i put into the exclusions this particular project in the folder SXU.Shared does not get excluded.

G. Ann Campbell

unread,
Feb 22, 2018, 3:01:57 PM2/22/18
to SonarQube
Hi again,

Nevermind the part about a separate thread. Somehow my inbox conflated your thread (which the Google Groups interface shows me is a completely separate one) with an earlier thread.

My apologies.


:-(
Ann
Reply all
Reply to author
Forward
0 new messages