Sonarlint doesn't pull sonarqube rules from server

I am trying to bind a sonarqube server to the sonarlint plugin in intellij to pull in the ruleset in sonarqube to show me issues inside of intellij.

For some Reason when I scan the file with sonarlint it shows no errors but in the sonarqube.com the files have issues which leads me to believe there is an issue with the plugin when it binds to a server because when I remove the binding and set local rules issues begin to show up.

setting my own rules inside of sonarlint plugin works just fine. But when i select Bind project to SonarQube/SonarCloud and configure the option i begin seeing an error inside of the log tab for the sonarlint plugin

Error Below:

Starting SonarTS Server
Deploying bundle to /Users/{{userid}}/Library/Caches/JetBrains/IntelliJIdea2020.3/tmp/sonarlint/.sonartmp_8840237824731938236/15046073373381757830
Failed to start SonarTS Server
java.io.IOException: Cannot run program "node": error=2, No such file or directory
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
	at org.sonar.plugin.typescript.ContextualServer.startSonarTSServer(ContextualServer.java:114)
	at org.sonar.plugin.typescript.ContextualServer.start(ContextualServer.java:92)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
	at org.sonarsource.sonarlint.core.container.ComponentContainer$1.start(ComponentContainer.java:272)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.Stored.start(Stored.java:110)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
	at org.sonarsource.sonarlint.core.container.storage.StorageContainer.doAfterStart(StorageContainer.java:127)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:126)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.start(ConnectedSonarLintEngineImpl.java:118)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$update$2(ConnectedSonarLintEngineImpl.java:176)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withRwLock(ConnectedSonarLintEngineImpl.java:330)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.update(ConnectedSonarLintEngineImpl.java:169)
	at org.sonarlint.intellij.tasks.BindingStorageUpdateTask.run(BindingStorageUpdateTask.java:96)
	at org.sonarlint.intellij.tasks.BindingStorageUpdateTask$2.run(BindingStorageUpdateTask.java:82)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:962)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:472)
	at com.intellij.codeWithMe.ClientId$Companion$decorateFunction$1.apply(ClientId.kt:159)
	at com.intellij.codeWithMe.ClientId$Companion$decorateFunction$1.apply(ClientId.kt:159)
	at com.intellij.codeWithMe.ClientId$Companion$decorateFunction$1.apply(ClientId.kt:159)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
	... 46 more

When Scanning the typescript files this is the log output:

Trigger: ACTION
[Action] 1 file(s) submitted
Configuring analysis with org.sonarlint.intellij.analysis.JavaAnalysisConfigurator
Using connection 'final sonarqube company' for project 'com.company.fc:projectname'
Analysing 'app.component.ts'...
Starting analysis with configuration:
[
  projectKey: com.company.fc:projectname
  baseDir: /Users/userid/projects/projectname
  extraProperties: {sonar.java.target=15, sonar.java.source=15}
  inputFiles: [
    file:///Users/userid/projects/projectname/src/app/app.component.ts (UTF-8)
  ]
]

    Start analysis
    Index files
    Language of file 'file:///Users/userid/projects/projectname/src/app/app.component.ts' is detected to

 be 'TypeScript'
    1 file indexed
    Available languages:
      * Python => "py"
      * Kotlin => "kotlin"
      * HTL => "htl"
      * JavaScript => "js"
      * Ruby => "ruby"
      * Scala => "scala"
      * Java => "java"
      * HTML => "web"
      * JSP => "jsp"
      * XML => "xml"
      * PHP => "php"
      * TypeScript => "ts"
      * Swift => "swift"
    Quality profiles:
      * htl: 'AEM HTL Profile' (17 rules)
      * java: 'Sonar Way + Craftsmanship + Checkmarx' (1032 rules)
      * js: 'Sonar way Recommended' (128 rules)
      * jsp: 'FindBugs Security JSP' (4 rules)
      * kotlin: 'Sonar way' (30 rules)
      * php: 'Sonar way' (101 rules)
      * py: 'Sonar way' (31 rules)
      * ruby: 'Sonar way' (29 rules)
      * scala: 'Sonar way' (28 rules)
      * swift: 'Sonar way' (61 rules)
      * ts: 'Sonar way recommended' (112 rules)
      * web: 'Sonar way' (18 rules)
      * xml: 'Sonar way' (4 rules)
    'JavaSquidSensor' skipped because there is no related file in current project
    'Python Squid Sensor' skipped because there is no related file in current project
    'Kotlin Sensor' skipped because there is no related file in current project
    'SonarJS' skipped because there is no related file in current project
    'ESLint-based SonarJS' skipped because there is no related file in current project
    'Ruby Sensor' skipped because there is no related file in current project
    'Scala Sensor' skipped because there is no related file in current project
    'JavaXmlSensor' skipped because one of the required properties is missing
    Execute Sensor: HTML
    'XML Sensor' skipped because there is no related file in current project
    'PHP sensor' skipped because there is no related file in current project
    'Analyzer for "php.ini" files' skipped because there is no related file in current project
    Execute Sensor: Contextual SonarTS
    Skipped analysis as SonarTS Server is not running
    'SonarSwift' skipped because there is no related file in current project
    Done in 20ms
    
    Processed 0 issues in 0 ms
    Found 0 issues

Using intellij 2020.3.2 with java 11

   / which node
   /usr/local/bin/node

   / node -v
   v14.15.5

   / npm -v
   6.14.11

sonarqube url:
http://www.sonarqube.{{companyname}}.com
node.js path inside of sonarlint plugin is:
/usr/local/bin/node

Hello @OVFJENK_8, welcome to the community! And thank you for your question.

When SonarLint is used in connected mode, it downloads both the analyzers and the analyzer settings from the server to make sure that the issues found are (almost) the same.

Here, I understand from your first log extract that your SonarQube server has a fairly old version of the TypeScript analyzer (about 18 months), which IIRC is not well supported in IntelliJ.

This can explain why you see issues in IntelliJ when you remove the server binding: SonarLint comes packaged with a newer, better supported version of the TypeScript analyzer.

So my advice here is to update your SonarQube server, or at the very least to update the JavaScript and TypeScript analyzers on your server to the latest compatible versions.

1 Like

thank you for the response, unfortunately i don’t think this is possible due to me not controlling the server i am trying to connect to, but i will inform business of this.