This version of SonarQube Server is no longer receiving patches. Please see the latest release for details on updating.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Supporting new languages

Six steps to support new languages in SonarQube 9.9.

For AI agents: You're in the SonarQube Server 9.9 documentation. For a list of all 9.9 pages, see the SonarQube Server 9.9 page index. For the whole site, see the page index or the full text. For another version, replace 9.9 in the URL with that version. The latest version has no version number in its URL.

The steps to cover a new programming language are:

  1. Write the grammar. This is the hardest part.

  2. Write a parser (a parser simply parses an input based on your grammar to yield a parse tree).

  3. Test your grammar, to ensure it is able to parse real-life language files.

  4. Write a few parse tree visitors. Some visitors will compute metrics such as Executable lines, while others will enforce Adding coding rules. A dozen or so visitors are sufficient for an initial release.

  5. Write a scanner Sensor, in a SonarQube plugin, to launch the visitors.

  6. Compute

    1. issues

    2. raw measures

    3. code duplications

    4. syntax highlighting

    5. symbol table

    6. coverage information (lines/branches to cover, line/branch hits)

In fulfilling these steps, the Sonar Language Recognizer (SSLR) can be an important resource.

Last updated

Was this helpful?