What sonar-plugin-api version should i use for Sonarlint?

Hi,

I’m currently in the process of developing a Sonarqube plugin with compatibility for Sonarlint. In my testing phase, I utilized the latest version of the Sonar-plugin-api (10.6.0.2114) with Sonarqube 10.4. In Sonarqube, everything worked fine, but in Sonarlint for VSCode, errors didn’t show up…

Upon further investigation, I found information in the compatibility section of the Sonar-plugin-api repository indicating that Sonarlint utilizes version 9.13.0.360 of the API.

This leads me to a question: If I want my rule to be visible in Sonarlint, is it necessary for me to use version 9.13.0.360 of the API instead of the latest version? Additionally, I’m curious about the update schedule for Sonarlint’s Sonar-plugin-api. When can we expect it to be updated?

Thanks in Advance.
Cédric

Hi @Giiltham,

thank you for reaching out on that matter.

First of all, yes it looks a bit confusing which Sonar Plugin API version is used by which SonarQube version and which SonarLint version.
The information on SonarSource/sonar-plugin-api is sadly outdated and we will fix that. Currently, all SonarLint flavors (except the one for Visual Studio) use the version 10.1.0.809 of the Sonar Plugin API.

A better way to find that information is to look at SonarSource/sonarlint-core, which utilizes the Sonar Plugin API and is itself consumed by the IDE plug-ins.

On the other hand, there are not many differences in the Sonar Plugin API from the latest versions, some new features may have been added and other stuff may have been deprecated, but nothing breaking since SonarQube 9.9 LTS.
This also leads me to my suggestion on which version of the Sonar Plugin API to consume: Take the one from the latest LTS release (in this case 9.9, which is Sonar Plugin API version 9.14.0.375) and then test with newer versions of SonarQube if everything is still working, sometimes a look at the changelog will already reveal breaking changes.

Now, regarding the rules not being visible in SonarLint. Is it downloaded when you configure SonarLint in connected mode to your SonarQube server, where the plug-in is installed?
The plug-ins are downloaded into your home directory (based on your OS) into .sonarlint/storage/<connection in hex>/plugins. If the plugins are not there, then the plug-in might not be SonarLint-compatible. This must be configured via the Maven property, see HERE for the documentation (search for sonarLintSupported).

In the case that the plugin is available locally but the rules are still not raising issues on the analysis in VS Code, we will take a deeper look.

Until then, all the best,
Tobias

Hi,

Thanks a lot for your response, very insightful,
Just tested in local and it’s working with version 10.1.0.809, but not with more recent versions, I think we’ll stick to the sonarlint-core sonar-plugin-api version.

I will try this on our main sonarqube instance and post updates here if not working.

Cédric

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.