which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
what are you trying to achieve
what have you tried so far to achieve this
*versions
Sonarqube 7.9.1
Scanner 4.6.2
*I tried “api/qualityprofiles/activate_rules?targetKey=‘MyQualityProfileKey’”.
It works if I want to activate all of the rules.
But I just wanted to activate specific rules(like csharpsquid:S2757, csharpsquid:S1698, …) on my custom quality profile.
So I added rule_key parameter and set the value to ‘csharpsquid:S2757’. then It activates only one rule. If I set the value to ‘csharpsquid:S2757,csharpsquid:S1698’ or ‘csharpsquid:S2757;csharpsquid:S1698’, It doesn’t work.
How can I set bulk-activate in Web API?
You can bulk activate/deactivate rules from the UI. All the actions in the UI are backed / supported / provided by the API. If you can do it in the UI you can do it in the API (altho to be fair, some actions are supported by “internal” API).
So I am not saying that you can’t bulk activate via the API. I’m saying use the UI to figure out how to do it.
You can use “api/qualityprofiles/activate_rules” and “api/qualityprofiles/deactivate_rules”, check the documentation on your SonarQube instance (http://your_server/web_api/api/qualityprofiles).
Hi Guys,
This is a bit old topic, but recently I had similar task, and this is how I do it.
I’ve used api/qualityprofiles/activate_rule to send requests to, and used Postman Pre-request/Tests scripts in order to loop through all rule keys that I need to activate for specific profile.
Create collection in Postman and set collection variables rules and rule with empty values.