How is the rule defined in xml files executed

(Jerry Wang) #1

Hi all,

Recently, I start to learn write custom rules for Sonarqube. I find two different ways. One is very easy to understand on official website, using IssuableSubscriptionVisitor and other APIs sonar provides.

However, when I read the sourcecode of sonar-findbugs-plugin. There is no class extends class IssuableSubscriptionVisitor, and just define rules in XML files, such as rules-findbugs.xml, with some descriptions. I think each rule in the XML files should be bound to some java class ? I wonder how to execute those rules from XML files.


(G Ann Campbell) #2

Hi Jerry,

The FindBugs plugin fires FindBugs itself and then (I believe) parses the resulting report. In other words, those rules are crafted and executed entirely differently. I’d stick with theIssuableSubscriptionVisitor if I were you.