TL;DR: I want only this folder (Scripts) to be scanned:
Now, I’m trying to narrow the focus of the scan as Unity creates a good amount of projects in the root folder (56). I was able to omit them with the
SonarQubeExclude parameter, but Unity refreshes the
.csproj files which removes my manual additions, so I won’t be able to go down that route. Although, it seems that .NET scanner does a fairly good job of omitting some of them, I still need a more narrow focus.
I am trying two alternatives without success:
I am reading from the documentation that
sonar-sources should be the first step when narrowing the focus, but I’m also interpreting that is not the best approach for
MSBuild as it does it automatically(?).
But let’s say, that it is okay in this case, I have not been able to find info on where to add these parameters. From reading around, the generic SonarScanner documentation says that I should "Create a configuration file in your project’s root directory called
sonar-project.properties". Now, is this only for the generic SonarScanner? Is this the way to go for the .NET SonarScanner too? Should I not use
sonar-sources with the .NET scanner?
I’m also inferring this from the note that appears on the “sonar-scaner-properties” in the conf folder of SonarScanner, as if I need to have a
properties file should be somewhere else.
#No information about specific project should appear here
And, would this be the correct format of the paths?
(you can see the folder hierarchy below)
I saw the second thing to try was Coverage Exclusions in the UI. But I’m having trouble understanding the format of the paths (and this is also true if I were to do the alternative above). My hierarchy goes like this, and I only want Scripts to be scanned:
Most examples I have seen with paths are lowercase, but I read it’s also case sensitive. If the one above is the pattern of my hierarchy and also taking the screenshot I shared above as the current situation, are these the right way of excluding them?:
This is what I’m adding to the UI but, it has not worked, I’m still getting those files scanned.
This is the config I’m using to run Sonarqube:
Language: C# Sonarqube: 18.104.22.168159 Scanner: MSBuild 22.214.171.124281 .NET Framework Invocation Process: Manual
Thank you in advance!