Problem while importing rules with repositoryKey="squid' to SonarCloud

Hello all,

I repost my question here since it’s a separate problem to Simple way to import quality profile rules.
I want to import quality rules from a SonarQube server to a SonarCloud server. The rules from which I want to import to SonarCloud mostly have the repository key named “squid”. However, these rules are not recognized at all by our SonarCloud. The result is that no rule is imported.
Do you have an idea whether is it because squid repository key is not yet activated on our SonarCloud or if “squid” is not supported, how could we find the equivalent rules?

Any help would be really appreciated.

Hey there.

At some point squid (which doesn’t mean much to end-users!) became java – and most rule keys were updated to make sure they match a common pattern (some rules used an ID, others CamelCase describing the rule).

If the version of the Java analyzer installed on your SonarQube server doesn’t match what’s on SonarCloud (or in this case, less than v6.0 of the Java analyzer), it’s possible for there to be a mismatch.

Neither SonarQube or SonarCloud handles the change in rule keys gracefully when importing a Quality Profile.

A few options might exist, other than manually recreating your profile.

  • Try changing all instances of squid to java in your exported Quality Profile and see how many rules successfully import. The rest, you’d have to look up and manually activate in your profile.
  • Upgrade your SonarQube instance to the latest version of the Java analyser available (assuming your current version of SonarQube is v7.9 LTS or higher). At that point you could export the Quality Profile from SonarQube with rule keys that will match what is on SonarCloud.

Thank you for the clarification.