2
votes

We have implemented a custom rule based on the BaseTreeVisitor in https://github.com/SonarSource/sonar-java/tree/master/java-checks/src/main/java/org/sonar/java/checks as described in http://docs.sonarqube.org/display/SONAR/Extending+Coding+Rules. We are able to deploy it and it appears as a new plugin in Sonar, but we couldn't find a way to add it to any of the quality profiles.

Is this the correct way to implement a custom rule? If yes, how to deploy & use it in a profile properly?

1
It is the correct way to implement a custom rule. You can't see your rule if you filter on inactive rules? - David RACODON - QA Consultant
Thanks for your comment David, the problem is that I have 20 pages of inactive rules and I don't know what name should the rule have. Should it be the name of the class? or where is this configured? - abalogh
Found it, thanks! Please add your comment as an answer so I can accept it :) - abalogh
I did not get you 'You can't see your rule if you filter on inactive rules' Could you please tell me how to activate the rules? I can see my custom sonar-plugin on dashboard but on in quality profiles - Sandy
The documentation link is broken - Paul Croarkin

1 Answers

3
votes

It is the correct way to implement a custom rule. You can see your rule if you filter on inactive rules.