I am creating a new plugin for SonarQube which allows developers to perform static code analysis on ESQL code.
Using Maven I can build a shell of a plugin, which produces the JAR file which I can place in the correct folder in order for it to be added to SonarQube.
The next stage is to write the Java classes for the rules, however I am unsure on what and where these look like. I am using the example from the following GIT repository: https://github.com/SonarSource/sonar-examples/tree/master/plugins/sonar-reference-plugin
Do I simply create a new package with some classes? And how do I actually rules?
If you want to write a rule engine for the ESQL language, this means that you must first write a parser for this language. And only after you completed this stage, you will create a rule engine based on that parser (with visitor classes that navigate through the AST and that create issues under specific circumstances).
You can take a look at how we implemented the Javascript plugin (see the code of version 1.3):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With