I am working on updating the XQuery plugin


(Loren Cahlander) #1

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.

(Alban Auzeill) #2

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


(Loren Cahlander) #3

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

(Loren Cahlander) #4

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

(Alban Auzeill) #5

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

(Martín C.) #6

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

(Loren Cahlander) #7

@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?