Simple way to import quality profile rules

Hello all,

I’d like to import quality profile rules from a SonarQube server into SonarCloud. I found that in SonarQube you can perform a back-up of those rules into a xml file. Is there a way in SonarCloud to import the rules from that xml file? Any help would be very appreciated. Thank you in advance.

Best regards,

Hello @minhtutonthat, welcome to our Community!

SonarCloud can also do backups and restoring of Quality Profiles, see the Quality Profile menu of your organization, the URL should be similar to:

https://sonarcloud.io/organizations/your_organization/quality_profiles

Can you please try to restore from the XML you have? The structure should be similar to this one below:

<profile>
  <name>Backup Test</name>
  <language>c</language>
  <rules>
    <rule>
      <repositoryKey>c</repositoryKey>
      <key>AssignmentInSubExpression</key>
      <priority>MAJOR</priority>
      <parameters/>
    </rule>
  </rules>
</profile>

Regards,

Alexandre.

Thank you. It was a problem of administrator right. When I got the correct admin right, I could perform the Restore action.
However I’ve run into another problem that you may be able to explain. The rules from which I want to import to SonarCloud mostly come from the repository key named “squid”. These rules are not recognized at all by our SonarCloud. The result is that no rule is imported.
So do you have an idea whether it’s because squid repository key is not yet activated on our SonarCloud or if “squid” is not supported, how could we find the equivalent rules?
Thank you in advance.

Hi @minhtutonthat, sorry for the long time. Have you solved the problem? To me looks like the “squid” repository needs to exist at SonarCloud, but i am not sure that this is the root cause. It is possible to you to share the exported file so i can have a look into it? Otherwise i can simulate it here, but will not be the same content for sure.