Is it possible to add new rule to existed profile?

(Taodong Lu) #1

In the official example:
New profile is created and new rules are added to the new profile.
I don’t create new profile. Is it possible to add new rule to existed profile?

(Gilbert Rebhan) #2

you can’t add a new rule to an existing - builtin - Quality Profile. If you look at the page of one of those Quality Profiles, f.e. https://yoursonarhost//profiles/show?language=js&name=Sonar+way+Recommended
you’ll see the ‘Activate More’ button is deactivated. So simply create a new QP based on the builtin QP and add your rule(s) to it.

(Julien Henry) #3


I confirm that even using plugin API, it is not possible to contribute to the same built in quality profile from multiple plugins. If you have a use case that may be interesting for others, feel free to share it.


(Taodong Lu) #4

OK, profile can’t be changed dynamically. I abandon the idea.

I try other solution: plugin A manage repo, rules and profile, plugin B is response to execute sensor and report rule defined in plugin A. But I fail:
09:47:48.049 ERROR: The rule 'g11n:wix-2001' does not exist.

sonarqube doesn’t support the action either?

(Julien Henry) #5

This use case should be supported. There is nothing to link back a rule definition to a sensor. Do you see the rule in the UI?

(Taodong Lu) #6

yes, I can see the rule in the Quality profiles

(Taodong Lu) #7

sorry, I used wrong repo key.
After I change repo key, I get right result.
It proves the user case is supported.