I have one big project in sonar server (Enterprise Edition v2025.1), and I want to duplicate java sonarway quality profile, and choose from there some rules for specific path, as described here:
Now the current status is that I have 2 java qualify profiles which I want to apply on this project, and I can’t find an easy way to filter per my new quality profile. The only filter I can use is the path, and then choose one by one my rules.
In case I have 50 rules it’s very frustrating… is there other way to filter per my needs?
so if I understand correctly, the only way which can work for me is to use sonarway java quality profile, and in the project analysis scope configuration, create multiple issues under ‘Ignore Issues on Multiple Criteria’ (where each one represent rule from the java quality profile which I don’t want to be applied on my path). Is that correct?
So just to clarify, if my project is using sonarway java profile, which currently has 548 active rules, and I want to keep only 100 rules for certain path, my only option is to create manually 448 entries? there is no shorter way? (assuming I can’t use other java quality profile for now, as other paths need the whole set of rules)
The shorter way would be to split the analysis: analyze “certainPath” as a separate project with a different profile and make sure it’s excluded from the analysis of the main project.
However, given that we’re talking about Java here, I fear that might impact the quality of the results because Java analysis reads not just the source of each class, but also the interactions within your project. Cut one package off from the rest and you may miss some important issues.
You’ll set up a second analysis and narrow sonar.sources for that analysis to just certainPath. You can probably leave sonar.java.binaries pointed to all the classes (that may help with accuracy).
And in the original/main project, you’ll add an exclusion for certainPath.
It’s too complicated… I think it’s a gap you need to find some solution for it. Maybe option to apply one quality profile at project level and apply another quality profile at path level (with exclude of this path in project analysis level)