SonarLint Connected Mode bindings by organisation don't create a `connectionId`

Please provide

  • Operating system:Windows 11
  • SonarLint plugin version: 3.16.0
  • Programming language you’re coding in: JavaScript
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): SonarCloud

And a thorough description of the problem / question:

  1. Open VS Code
  2. Switch to SonarLint panel
  3. Expand SonarCloud in Connected Mode
  4. Click the + next to the relevant organisation
  5. Select the folder from the dropdown
  6. Select the project from the dropdown

Expected outcome: settings.json generated with connectionId and projectKey.

Actual outcome: settings.json only has projectKey, causing the project quality profile to not be applied

Hello, thanks for reporting this!

I have not been able to reproduce this behavior with version 3.17 which was released yesterday, could you please update and check whether the issue still exists?

If it does, would it be possible for you to share the contents of your VSCode user settings for the following properties:

  • sonarlint.connectedMode.servers (deprecated)
  • sonarlint.connectedMode.sonarqube
  • sonarlint.connectedMode.sonarcloud

Thanks!

I checked with 3.17 and had the same issue as before with the "connectionId": "<default>" line missing.

{
  "sonarlint.connectedMode.project": {
    "projectKey": "fake_key"
  }
}

For servers and sonarqube I have no entries in settings.json.

  "sonarlint.connectedMode.connections.sonarcloud": [
    {
      "organizationKey": "quitch",
      "token": "some_random_characters"
    },
    {
      "organizationKey": "some-org",
      "connectionId": "some-org"
    },
    {
      "organizationKey": "some-other-org",
      "connectionId": "some-other-org"
    }
  ],

I’ve also found that when sonarlint identifies that the folder can be bound by itself, through the message “Do you want to bind folder ‘folder-name’ to project ‘org-key_folder-name’ of SonarQube server ‘’?” and you click “Configure Binding”, it sets up settings.json correctly.

{
  "sonarlint.connectedMode.project": {
    "connectionId": "<default>",
    "projectKey": "fake_key"
  }
}

Thanks for sharing!

I was indeed able to reproduce this behavior as soon as there are several connections defined and one has no connectionId. I created a ticket to address this.

As a workaround, you can either add a connectionId to the connection that doesn’t have one (and use it in the folder settings), or manually add "connectionId": "<default>" to the sonarlint.connectedMode.project property in the appropriate folder settings.

1 Like

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