Programmatically Compare and Apply Quality Profile Differences in SonarQube

I’m currently working with several SonarQube installations and aiming to streamline the application of Quality Profile changes across them. To achieve this efficiently, I need a method to not only Compare Differences between Quality Profiles but also to effectively utilize the results of such comparisons programmatically.

Ideally, I’m looking for a way to automate this process. Is it possible to retrieve a list of all rule-IDs that constitute a Quality Profile via the WEB API? Furthermore, can a rule-ID be added to a Quality Profile through the WEB API as well?

While I could potentially develop this logic independently, I believe it would be more beneficial to have this functionality natively implemented within SonarQube itself. Therefore, I would like to propose extending SonarQube’s features to include built-in support for programmatic Quality Profile comparison and management.

Thank you for considering this enhancement.

Cheers, Daniel

SonarQube Versions: Newest and 8.9.x LTS

Objective: To create a backup of the differences resulting from a Quality Profile comparison.

  • My goal is to apply this diff to a different Quality Profile.
  • To facilitate this, I envision a workflow that includes:
    • Storing the diff in a temporary profile.
    • Importing all rules from this temporary profile into a target Quality Profile.
    • Potentially exporting and importing the diff as an XML file for transfer between different SonarQube instances.

Current Limitations:

I have already compared two Quality Profiles within SonarQube’s interface. However, I haven’t found any built-in options to save these differences, or to transfer and import them for application to other profiles.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *