Configuring connecting mode in vscode with sonar-project.properties file

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version: 3.21.0
  • Programming language you’re coding in: COBOL
  • Is connected mode used:
    • Connected to SonarQube (v 9.9):

In documentation you mention “Once a connection is established, SonarLint for VSCode tries to automatically detect a remote SonarQube or SonarCloud project to bind with the locally opened workspace folder. If the locally opened folder contains a sonar-project.properties or a .sonarcloud.properties file, SonarLint will try to configure the binding with the remote project defined in that configuration file.”

I first configured project bindings, and it registered configuration in settings.json.
I would prefer to configure project binding in sonar-project.properties file.
I tried several property lines, but it does not work. Can you explain me which lines I should put in the properties file ?

Thanks, regards.

Hello @Jean-Michel.Petit and welcome to the community!

For the sonar-project.properties file content we expect to have the following for the SonarQube project configuration:

sonar.host.url=https://my.sonarqube.com
sonar.projectKey=my.project.key

And the following for the SonarCloud:

sonar.organization=myOrganizationKey
sonar.projectKey=my.project.key

The project key can be found in the project information section on the project page

UPD:

Clarification regarding the purpose of setting.json and sonar-project.properties files just in case.
The sonar-project.properties file is not used by SonarLint as a storage for configuration. It has data that may help SonarLint to bootstrap setting up the connection and binding.
But during setup, the actual configuration will be stored in settings.json. So if only sonar-project.properties contains information about the binding and not settings.json - binging is not configured.
If I understood you right and you don’t want to store the information about the binding and connection in the settings.json file, can you please elaborate on why?

Thanks. It works fine.

Cool. Good to here!
I’ve created a ticket to add these steps to a new article on the Connected Mode docs page.

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