How to define a new programming language?


Based on the feature of sonarqube to support the specefic programming language (for example: “DSL” for Huawei CRM product), would you please help me how to define a new programming langauge, the grammer, its parser, the relevant scanner sensor, and the rules in sonarqube? Are there any samples for this processes? Is there any document to support them completely?
I try to achieve this in order to reduce some bugs based on some new defined rules.
Thanks in advance.

Hello @zahra_majidi and welcome to the community!

Do I understand correctly that you want to create you own language analyzer for your own needs? If so, do you want to use it in SonarQube, SonarLint or both?

Dear Kirill Knize,
thanks for greeting.
yes, It is correct. I want to create my own language analyzer for our own needs if it is possible and use the sonarqube to analyze the code. I am trying to get more information about sonarqube, sonarLint. what is the difference and what is the advantage of using both of them? In addition, what is the cost of time to create the new language anlyzer? what is your concern about it? Is it correct or not?
In first step, I want to run sonar scanner using sample project for maven using java 8, because our project is based on java 8. I got some errors.
Is sonar scanner only compatible with Java 11 ? when we want to build the sample project using Java 8 when executing the scanner, It returns error.
Would you please help me about the above concerns?
Thanks in advance

Hello @zahra_majidi,

First of all we won’t help you define this new programming language, grammar, parser, etc. You will find plenty of resources on the web to help you with this.

However we can help you integrate this analyzer in our ecosystem. There is a documentation page about how to write custom plugins for SonarQube: Plugin basics | SonarQube Docs

Please note that third-party plugins are supported only on SonarQube, SonarLint won’t run them (see our FAQ). If you want to run your analyzer in the IDE you will have to fork SonarLint.

This thread is in the Plugin Development section and we will be happy to help you further if you have any question.

Regarding your issues with running the scanner, you can find the required Java version in the prerequisites for the SonarQube version you use (it is indeed Java 11 for the latest). If you have a question specific to scanners, I encourage you to open a new thread and giving more details about errors you encounter.

Hope this helps