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?
It is the correct way to implement a custom rule. You can see your rule if you filter on inactive rules.