I spent some hours to resolve an sonar-checkstyle plugin issues that is about importing a profile from xml file which contains template rules. I want to import a template rules to resolve this issue. I believe that it used to work long time ago when Sonarqube allowed multiple activation of one rule, but since Sonarqube 4.4+ it is not working.
As far as I investigated, I believe it is not possible to import a template rules due to following.
- Activating a template rule is not allowed. One should first define a custom rule from template and activate that rule in order to use the template rule.
- Sonarqube server only activates rules and does not define custom rules from template rule when importing xml file. relevent code in sonarqube
- Plugin API does not provide way to define custom rules from template rule. It only provides a way to define a template rule. relevent docs is plugin api
Is there any way to define a new custom rule from template rule while importing profile? If there is no such way, I think it would be great to have new feature that supports importing a custom rule.
Thanks for reading this topic.