In the official example: https://github.com/SonarSource/sonar-custom-rules-examples/tree/master/java-custom-rules
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?
Hi,
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.
Regards,
Gilbert
Hi,
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.
++
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?
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?
yes, I can see the rule in the Quality profiles
sorry, I used wrong repo key
.
After I change repo key
, I get right result.
It proves the user case is supported.