Hello,
I am implementing a custom SonarQube rule in Java:
@Rule(key = "CustomRule", description = "Custom Rule Description")
public class CustomRule extends IssuableSubscriptionVisitor {
@Override
public List<Kind> nodesToVisit() {
return Arrays.asList(Kind.MEMBER_SELECT, Kind.METHOD_REFERENCE);
}
@Override
public void visitNode(Tree pTree) {
}
}
The rule currently visits two kinds of nodes: MEMBER_SELECT and METHOD_REFERENCE. Is it possible to enable and disable certain Kinds on the SonarQube server? For example, I would like the rule only to validate nods of the kind of MEMBER_SELECT by default but as a user, I want the option to enable METHOD_REFERENCES nodes afterward e.g. in the SonarQube Server UI.
As a workaround, I could probably use “@RuleProperty” boolean variables but maybe there already is a way to easily enable and disable certain nodes to visit in SonarQube on the user’s side.