Can I filter issues by quality profile?

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?

Hi,

No. You don’t.

Only one profile for any given language runs during analysis.

It’s not clear to me what you’re trying to achieve, but only one profile is being used. You can see what it is on the Project Information tab.

 
HTH,
Ann

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?

Hi,

You can use any profile you like.

Okay, so if you want specific rules applied to parts of your project but not to all of it, then yes, multi-criteria exclusions are your best bet.

 
HTH,
Ann

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)

Hi,

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.

 
HTH,
Ann

How technically I can analyze “certainPath” as a separate project with a different profile?

Hi,

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.

 
HTH,
Ann

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)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.