Easier way to create rules and analyze new languages or file formats

Hi, team.

I wanted to share with you my experiences when developing a plugin for SonarQube.

My requirements were to build a plugin for two mainframe languages / formats.

When I started learning the technical requirements for SonarQube I saw that SonarQube doesn’t offer an easy way to develop plugins: the developer must learn about text parsers, SonarQube plugin internal APIs and a Java development framework.

I didn’t found also a generic plugin that would be capable to analyse every type of
language and dynamically add rules without developing then in Java and rebuilding a plugin.

Then, I decided to develop this kind of plugin to, when possible, try to cover these features:

  • Dynamic creation and modification of rules. Only a SonarQube restart is required, at most.
  • The rules are programmed with Javascript and configured with json.
  • The rules repository could be a database or a directory of files
  • The AST tree is generated from ANTLR4 grammar files.
  • There are Javascript APIs that allow to walk along the AST tree to ease the analysis of source files from the scanner.
  • The rule developer can create Javascript libraries to add language specific APIs to the generic ones.

Is it possible, the SonarQube team could allow this kind of rule development for future SonarQube versions?.

Thank you for this wonderful platform.

Best regards.


Welcome to the community!

Are you aware of the Generic Issues format?


Thank you, Ann.

I didn’t know about this feature. Its an interesting one. However, our SonarQube platform is already being used with many other plugins. We wanted a unified method to manage rules. I think the import feature does not solve the problem with the custom linter.

What I am putting on the table is a generic way to create and maintain rules in a more abstract layer over the SonarQube’s plugin infrastructure. And it works. It would be nice if SonarQube had this kind of generic plugin.

Thank you again and best regards