I want to use the SonarLint plug-in for VS Code. In the settings.json file I need to set the path of the compile_commands.json file via the sonarlint.pathToCompileCommands option.
The thing is that this path is not fixed. It can happen that I have more than one cmake project in my repo or the name of the cmake build directory may depend on something like the build type (debug, release etc.).
According to VS Code’s variables reference I should be able to do this either via config: or command: variables. The cmake extension seems to support commands as well.
I have kind of the same problem with the sonarlint.connectedMode.project.projectKey setting once I want to set up connected mode. This also applies to other languages.
Why doesn’t SonarLint just read the sonar-project.properties files I already created for sonar-scanner. I would abandon Sonarlint completely and just run sonar-scanner via some generic linter extension, if it wasn’t that slow compared to SonarLint.
Thank you for raising the request to support variable substitutions.
At the moment, SonarLint doesn’t support this functionality and it has been recorded as an opportunity on our side. Supporting variable substitutions for Sonarlin may come in the future but is not a short-term priority for now.
If a folder contains sonar-project.properties file then Sonarlint will automatically try to configure binding with a remote project. Please see the project binding documentation for details.