I’ve read multiple times that SonarLint was not open to third-party plugins, but I wanted to confirm if that was still the case as of today, especially with SonarLint VSCode. As sonarlint-core seems to be running with a standalone backend (quite similar to sonar-scanner then), it would be nice to lift this restriction
By the way, here is a stacktrace that I got in VSCode on a project bound to a SonarQube instance with my language plugin:
[Info - 12:00:01.014] Analyzing file "file:///c:/Users/xxx/projets/pct/src/progress/pct/compile.p"...
[Error - 12:00:01.598] Analysis failed
java.lang.NullPointerException: Cannot invoke "org.sonarsource.sonarlint.core.commons.api.SonarLanguage.name()" because "language" is null
java.lang.NullPointerException: Cannot invoke "org.sonarsource.sonarlint.core.commons.api.SonarLanguage.name()" because "language" is null
at org.sonarsource.sonarlint.ls.telemetry.SonarLintTelemetry.analysisDoneOnSingleLanguage(SonarLintTelemetry.java:76)
at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyzeSingleModuleNonExcluded(AnalysisTaskExecutor.java:366)
at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyzeSingleModule(AnalysisTaskExecutor.java:314)
at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyze(AnalysisTaskExecutor.java:232)
at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyze(AnalysisTaskExecutor.java:197)
at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.lambda$analyze$2(AnalysisTaskExecutor.java:165)
at java.base/java.util.HashMap.forEach(Unknown Source)
at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyze(AnalysisTaskExecutor.java:165)
at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.run(AnalysisTaskExecutor.java:137)
at org.sonarsource.sonarlint.ls.AnalysisScheduler.lambda$analyzeAsync$1(AnalysisScheduler.java:261)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
SonarQube 10.4.1 Dev Edition - VSCode plugin 4.4.1
And thinking about it, there’s already an alert box when installing external plugin in SonarQube. Same could be done in SonarLint extension for VSCode, user would have to confirm if he wants to execute external plugins or not.
There’s no technical reason for it. It’s because we try to be really protective of the developer experience, and nowhere moreso than in the IDE. That’s why we don’t download non-native analyzers in connected mode - because we can’t control (i.e. safeguard) the behavior/performance.
Well, that’s why we’re not supposed to be downloading 3rd-party plugins. By default every plug-in that is not for one of the supported languages by the IDE (this case VSCode) shouldn’t be downloaded, so I’m not sure why the presence of your plugin in your connected instance would cause this. Is your plugin an extension of one of the “native” languages, or an analyzer for a brand new language?
My plugin is for a new language. I did the test again on a different machine, removed the .sonarlint directory, opened my project directory in VSCode, attached it to my private SQ instance. My plugins were downloaded in .sonarlint. Property SonarLint-Supported is set to true in this plugin, that might be enough for SonarLint to download it.
We have created a SLLS-230 ticket on our side to fix the NPE issue. You can track the progress directly in the ticket. A the moment, the fix is scheduled for the next release of SonarLint for VSCode .
Property SonarLint-Supported is set to true in this plugin, that might be enough for SonarLint to download it.
Hi, was reading the above discussion, and would like to double check: is it, or is it not possible to develop a custom SQ plugin for Java, with a link to extensions to SonarLint ? We were considering this as we are developing deep semantic analytics for Java and the Sonar platform could be stack of choice for this, provided we can build both on the plugin and in the IDE/Lint side. Thanks !