I am working on updating the XQuery plugin

I am looking to make a new SonarQube plugin for the XQuery language. The current plugin is out of date and I cannot get it to compile, so I am planning to start from scratch. I already have and Antlr4 grammar and lexer at https://github.com/lcahlander/xqdoc. I would appreciate any tutorials for creating a Sonar plugin. I found the following link https://docs.sonarqube.org/display/DEV/Supporting+New+Languages, but I think that I need a tutorial or even a class maybe.

Any help that people can give me would be appreciated.

You can look at the code of this existing plugin https://github.com/SonarSource/sonar-xml or other plugins of https://github.com/SonarSource/

Alban

Are there any example plugins that are Antlr4 based? I am looking for one with one or more files ending in the extension ‘.g4’.

I just found the following articles. You might want to create a link to them in the Sonar documentation.

A SonarQube plugin for Kotlin - Paving the way
A SonarQube plugin for Kotlin - Analyzing with ANTLR
A SonarQube plugin for Kotlin - Creating the plugin proper

Open source analyser plugins provided by SonarSource do not parse using Antlr but the SonarSource’s sslr library. But it’s not because you use a different parser library that you could not take example on those analyzers. If you can convert a source file to an AST with location (line, column) and preferably it’s visitor, it should be similar. This is SonarSource open source analyzers repositories by language: xml, html, (kotlin/ruby/scala), go, css, TypeScript, python, flex, php, C#, Java, Javascript

1 Like

Hi @lcahlander, are you still working on the plugin?

@cig0 Other things have taken immediate priority, but I still have this in the works. I have an updated Antlr4 grammar at https://github.com/lcahlander/xqdoc/tree/master/src/main/antlr4/org/xqdoc that I will be using. Are you interested in helping?

Hi Cahlander,

did you develop the plugin, i am looking for the same, pls do share if it is developed already. plugin for xq analysis. i would like to contribute as well. do let me know if any help needed.

Thanks,
Ramya