Importing from another Sonar Instance shows less active rules

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    9.9 LTS
  • how is SonarQube deployed: zip, Docker, Helm
    Docker
  • what are you trying to achieve
  • what have you tried so far to achieve this

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
Original Python Rules Active: 183
image

After importing to another server
image

Why there is a difference ??

Hi,

What have you imported? Was it a Quality Profile?

If so, are both SonarQube instances - the one you exported from and the one you imported into - at the same version?

Do you have plugins in the source instance that aren’t available in the target instance?

 
Ann

Yes, imported Quality profile for Python.
Both are exactly same version.: 9.9.0.65466
One Importing to has one plugin: **Azure Active Directory (AAD) Authentication Plugin.

Hi,

Can you identify what rules are missing? Are they perhaps from a rule template that hasn’t been created in the target instance?

 
Ann

Is there a automated way to to that. There are lot’s of rules.
How do I check rule template?
Original server Rules for Python are 230,
Imported server Rules show 419.

They are installed exactly same, not modified any rules also. Not sure what config is making to see more rules in new server.

Hi,

I was focused initially on the counts of active rules in your two copies of the profile. Now that you’ve drawn my attention to the inactive / overall rule count… it’s difficult for me to believe that both servers are at the same version with the same set of plugins.

But to answer your question, there is no automated way to do the comparison, but it’s not hard to do via the UI. You would go to the rules page in each instance and begin by filtering on the language. Then you can check the repositories in each instance. Do both instances have all the same repositories? With the same rule counts in each?

Are there the same counts for each rule type (Bug, Code Smell &etc)? For each severity?

 
Ann

Once you’ve narrowed down the discrepancy that way

Actually I am interested in Active only. Not overall. Is there a way to export these rules to Excel or may be through an API ?
Then I can do the diff.

Original server:
SonarQube ID information
Version: 9.9.0.65466
Date: 2023-03-22

New server:
SonarQube ID information
Version: 9.9.0.65466
Date: 2023-03-22

I pasted image in the beginning. Are you asking about that regarding counts?

Hi,

You’ve asked about why there are fewer rules in a Quality Profile you imported into a server than there were in the source server.

Going back to your screenshots in the original post, I see

  • there are fewer active rules in the target server’s QP
  • there are more overall rules in the target server

Both of these things point to a different set of rules being available in each server.

We can’t go any further in diagnosing your original question until we figure out the differences in the underlying sets. One way to do that is on the rules page, using the rule counts shown in the facets, as I described earlier.

I suspect this comes down to the plugins installed - or not - on both servers. But you’ll have to do that sleuthing to find out.

 
HTH,
Ann