Java – sonarqube – helps create a new language plug-in
I'm creating a new plug - in for sonarqube that allows developers to perform static code analysis on esql code
Using maven, I can build a plug-in shell that generates jar files, which I can put in the correct folder to add to sonarqube
The next step is to write java classes for the rules, but I'm not sure about their appearance or location I am using the following example from the GIT Repository: https://github.com/SonarSource/sonar-examples/tree/master/plugins/sonar-reference-plugin
Do I just create a new package that contains some classes? How do I the actual rules?
Solution
If you want to write a rule engine for esql, this means that you must first write a parser for this language Only after completing this phase will you create a rule engine based on the parser (visitor class with navigation AST and creating problems in specific cases)
You can see how we implement the JavaScript plug-in (see the code of version 1.3):
>The "JavaScript squid" module is where the parser is written > "JavaScript checks" module is where the rule engine (based on the parser) is written > "sonar JavaScript plugin" module is an actual plug-in, which embeds the parser and rule engine and provides all the adhesives required for their circumference