i am playing around with multiple installations of Sonarqube. I would like to apply Quality Profile Changes to them. For this i need to not only compare QPs but also to be able to “work” with the results of such a comparison.
How would i be able to do this programattically, if i needed to? Can i get the list of all rule-IDs a QP consists of via WEB API? Can i add a rule-id into a QP via WEB-API?
I would prefer not to create this logic for myself, i’d rather see this implemented in Sonarqube itself. Please consider extending Sonarqube functionality.
which versions are you using
(SonarQube: newest and 8.9.x LTS , Scanner:yes - irrelevant, Plugin:yes - irrelevant, and any relevant extension: no)
what are you trying to achieve:
I would like to backup the Diff of a comparison between two Quality Profiles
- i want to apply this diff to a different quality profile
- for that i would like to
- store the diff in a new temp-profile
- import all rules from the temp-profile into a target Quality Profile
- maybe “export to xml” / “import from xml” the diff to a different sonarqube instance before that
what have you tried so far to achieve this:
I performed a comparison of two Quality Profiles and searched in the all the options i get presented then but did not find any way to backup the differences or transfer/import them to some Profile
Sorry, but you will need to implement this functionality yourself. The Web APIs should help. There’s documentation linked from the page footer, but you’ll get the best start just pulling the data you want via the UI and using your browser’s console to see what calls it makes.
i thought so, but wanted to make sure
if i may ask … is there already an existing decision to not implement something like this? if there is no such decision … how would i propose it “the right way”?
Uhm… it’s not that there’s a decision against it. It’s that there’s no reason for us to ever consider it. We believe everything should ideally be consolidated in one centralized SonarQube instance. So there shouldn’t (in our world view) be a reason to need this.
a different use case for us now is the switch between community and commercial edition.
When i checked the “Sonar Way” Quality Profile there is a delta between source SQ and destination SQ (the delta widens, as we have inherited our profile from Sonar Way and added some more rules.
I want to use the commercial edition with a QP inherited from “Sonar Way” but i do not want to “handcraft” the to-be-added-rules.
How would i lobby for re-evaluation of your world view? (royally, i presumed you are talking about “company vision”)
This ideal version of one sole sonarqube server instance is … i do not know, it might be worth a reality check. Maybe the minority of users (not customers) are sharing this ideal version and instead have many sonarqube instances popping up where need is be.
I think, a better ruleset-“diffing” support probably would be beneficial to everyone … and in addition it would support possible to-be-customers on their road to commercialism \o/
There’s no tooling to apply changes, but there is a built-in ‘compare’ function when you want to contrast profiles within an instance. (Look under the cog menu in the list of profiles). So that should be helpful in comparing your custom profile to the evolving Sonar way.
You know, don’t you, that the ability to set a parent profile is built in? With an inherited profile, you have the ability to add rules and to change the severity of the inherited rules, but not to delete them.
Feel free to create a new ‘Suggest a New Feature’ thread. You can reference this one if you like, but it’s probably best to make your new thread self-contained and lay out the full logic there.
I think that is the feature-area i would be requesting something for. The comparison is helpful, but functionality that consumes the result of such a comparison would be beneficial imo.
You are right, ofc, i know that.
But i also know that that a profile - when exported to xml and then imported back from xml - “loses the inheritance to Sonar Way” (which is understandable!)
… that is why i think some support for “i have a set of ex-/imported rules here and i want a (diffed) subset of these rules added to a new (inherited) quality profile” would be beneficial.
I will do that when i find the time to craft that posting, thank you!