SonarLint connected Mode VSCode

I am trying to use SonarLint in connected Mode, in conjunction with sonarqube enterprise server, but till now haven’t had the success.

Here is what I have tried:

Configured settings.json in VSCode

“sonarlint.connectedMode.connections.sonarqube”: [
{
“serverUrl”: “https://myEnterpriseSonarServer.com”,
“token”: “ef7ddc7b6c856cc”
}
],
“sonarlint.connectedMode.project”:
{
“projectKey”: “conan-scripts”
}

  • Questions:

To verify that my source code is analysed “while in connected mode”, I make a code change and check the sonarqube “token” page for the last access time for my token. For some reason, the token is not accessed (which should have been by vscode for connected mode).
Also, the Active Rules defined on the connected project does not seem to sync to VSCode
Here is the package.json (16.3 KB) (which does not contained any information on connectedmode servers)

:question: How do I verify that the connected mode is established correctly on VSCode? is there a log that I can check?

Further, I see that below languages are supported by SonarLInt offline mode (and are available in my VSCode SonarLInt Rules as well).

  • HTML
  • Java
  • JS
  • PHP
  • Python
  • TS

:question: how do I check what languages are supported in connected mode? I would like to analyse a C project

Hi,

Yes, if you look at the SonarLint output, after enabling verbose logs, you should see this each time an analysis is triggered:

[Debug - 15:30:04.757] Analysis triggered on 'file:///home/julien/Prog/Projects/sonarlint/sonarlint-vscode/scripts/prepare.js' with configuration: 
[
  projectKey: org.sonarsource.sonarlint.vscode:sonarlint-vscode
  baseDir: /home/julien/Prog/Projects/sonarlint/sonarlint-vscode
  extraProperties: {}
  inputFiles: [
    file:///home/julien/Prog/Projects/sonarlint/sonarlint-vscode/scripts/prepare.js (UTF-8) [js]
  ]
]

The presence of the projectKey attribute is a confirmation the connected mode is used.

Connected mode is not reaching the server continuously. It is only contacting the server to fetch (and cache) some metadata needed to ensure SonarLint analysis will produce similar results than SonarQube/SonarCloud analysis (enabled rules, file exclusions, issue suppresion, …). To “refresh” the local storage of those metadata, you have to manually trigger it (use SonarLint: Update all projects bindings to SonarQube/SonarCloud action).

I agree the documentation is missing here. Only Apex and PL/SQL are added by using connected mode. C is not yet supported, you can follow/vote for:
https://community.sonarsource.com/t/sonarlint-for-vscode-c-c-support/4732

A post was split to a new topic: Connected mode configuration