Using Sonarqube 7.9.1 LTS
I have a team at my org that is trying to onboard with 30+ Typescript repositories.
These projects are structured very similarly, so they want to be able to set the same exclusions/other settings for all of these at once, rather than having to configure them individually.
Is there a way in the UI for this to be done?
I will probably have to script it for them, and they’d still have to set these specific inclusions for each project.
Note that they are not using a sonar-project.properties file, because our CI system takes care of using the right key/branch/etc (but our CI system is not configurable per team, so adding exclusions in the CI options would affect other teams who also use Typescript).
Any guidance is appreciated. Thank you!
I am so glad you asked! (Really, I am. Usually I have to beg/cajole people to set their exclusions via the UI.)
Exclusions can be set at the global level
This screenshot only shows coverage exclusions. The other types are further down the page; just scroll. The exclusions you set at global level will automatically be inherited by all projects that don’t override them locally. Just to be real explicit about this, setting exclusions at the project level means they’ll be used instead of not in addition to ones set at the global level. The docs describe the precedence.
I think this will work for now – but it looks like there isn’t a perfect solution for this –
I have two exclusion rules A and B
I may have one set of 50 projects that require exclusion A, but DO NOT want to exclude B
I may have another set of 50 projects that require exclusion B, but DO NOT want A.
Either way, 50 projects will need their exclusions set manually.
I think the ideal feature I’m looking for is profile setting templates – define a settings profile, and apply it to X number of projects by regex/tag/selection.
I’m guessing this use case isn’t that common if the feature doesn’t already exist. I will probably end up writing a utility service that allows me to bulk apply pre-defined project permission sets, and update those permission sets at will.
If we’re talking about rules, then maybe have 2 different profiles?
I am specifically referring only to the
sonar.coverage.exclusion parameter – is there a way to set parameters like that for a Quality Profile?
For coverage exclusions, your best bet is to set the exclusions for the larger set at the global level & override at project level for the smaller set.
I know it’s not optimal, but it’s the best I’ve got.