I am using connected mode on sonarlint but not getting the same rules

  • Operating system: Ubuntu 22.04.4 LTS
  • SonarLint plugin version: 10.10.0.79575
  • IntelliJ version:2024.2.2
  • Programming language you’re coding in: Kotlin
  • Soarqube version: 9.9.3

And a thorough description of the problem / question:


I have setup a connection mode with a token to sonarqube. One thing that confuses me is that it seems the wrong nodejs version is displayed. My main problem is the mismatch of problems that are displayed on sonarqube and sonarlint. As i understand they should display roughly the same rules in conncted mode.

rules i see on sonarlint
I couldn’t find anything useful in the logs. What could be causing this?

Hello @markjuric, thanks for reaching out to us about this issue.

There appears to be a problem with how we load Node.js as defined by the user. It seems that when opening the settings, we set Node.js to the automatically detected version on your machine (for example, it will likely take the node version that appears when typing node -v). In this case, when changing the Node.js version, I would recommend not opening the settings afterward until we fix this issue.

Also, please note that when setting a specific Node.js path, it will be considered on the next restart (we have this ticket tracking this improvement). However, as I mentioned, opening the settings dialog will reset this path to the automatically detected node, so do not re-open the settings after modifying the path.

To make sure that you are using the correct version, you can enable logs in SonarLint, analyze a JS/TS file, and verify that you are using a specific node version by checking this log:

 [2024-09-26T10:10:29.847] [sonarlint-analysis-engine] DEBUG sonarlint - Launching command ***/.nvm/versions/node/v18.20.4/bin/node -v
 [2024-09-26T10:10:29.852] [sonarlint-analysis-engine] DEBUG sonarlint - Using Node.js v18.20.4.

Regarding the bug of loading the automatically detected Node.js version when opening the SonarLint settings, I have created this ticket that we will tackle for the next release.

Lastly, as mentioned by our requirements page, we support analysis of JS/TS with Node.js >= 16, and we recommend using Node.js >= 18.

There could be many reasons for the mismatch with the issue from SonarQube. Normally, we should effectively display the same issue between SonarQube and SonarLint in Connected Mode.

Could you try without Connected Mode to see if the issues are raised?

We would also appreciate a reproducible code snippet of an issue that was not reported locally but on your SonarQube server. Sharing the SonarLint logs of an analysis could also help.

Thank you!

For logs do you mean the tab in the view that says log because i there is no log about the version of node.js under that log
Log
on this image you can also see that when im not in connected mode that i have only unused import issue
here is an example of one rule
exaple
I am unable to provide logs, sry.

If you follow our documentation to get logs, you should see the Node.js mention.

- Open the SonarLint tool window: View > Tool Windows > SonarLint.
- Enable the Analysis logs and Verbose output in the tool window settings.
- Find the logs in the Log tab of the tool window.

Otherwise, it would help to have an example of your code or a fake example where you reproduce the same behavior.

Sry for not replying,

Its ok now i was using third party and needed detekt, but for logs i dont know if it changed but settings for verbose and analysis are under the 3 dot options button in logs.

Regarding Node.js, a new version of SonarLint has been released, including a fix for loading it.

As I understand, your problem is resolved? Could you please elaborate on what was the issue?