Connected to SonarCloud or SonarQube (and which version):
Hi there,
In general, I could manage to connect the Project in VSCode to the SonarQube server. The settings are stored inside the vscode parent folder under .vscode/settings.json.
My problem now is, that the folder setup used in VScode contains sub-folder as git submodules. Each submodule has its own sonar analysis configuration and SonarQube project assigned.
Now, in order to use sonarlint in VSCode, it would be necessary to not just connect the parent folder to SonarQube, instead each sub-folder would require a “Connected Mode” setting in its sub-folder.
Is this somehow possible ?
Can the .vscode/settings.json be extended by several server configurations, each using some kind of “baseDir” with respective sonar project key ?
Hello, welcome to the community! And thanks for your question.
For such a setup, I would recommend opening each git submodule as a workspace folder in VSCode, this would allow you to configure separate bindings for each folder.
Hi Jean-Baptiste,
this I know. However, this isn’t an option since it would require to switch between workspaces for development all the time.
We have the parent repo opened as a workspace which allows to develop in several sub-repos (submodules) and dereference symbols.
Then I would kindly request such a feature. Would that be possible ?
Danny
If you then use “File” > “Open Workspace From File…” with this workspace file, you will have the 3 submodules open as workspace folders in the same workspace, and you will be able to bind each folder to a separate project on the server.
I managed to setup the workspace structure as you indicated.
It requires now, however, a compile_command.json to be located somewhere!?
Although, I have the Makefile Extension, it doesn’t seem to support such a workspace organization and I didn’t succeed to configure each .vscode/settings.json for the makefile extension to generate each compile_command.json separately :-/
I’ll continue to try, maybe something else to generate the compile_command.json …
Actually, I found the python compiledb module.
Each submodule folder now contains a compile_command.json file which should be used for sonar analysis. However, I’m still stuck, sonar analysis apparently are not triggered
I’ll come back to give more details …
In the SonarLint output I see that the analysis is started but also that other languages are tried:
[Debug - 09:37:00.368] * kubernetes: 6 active rules
[Debug - 09:37:00.368] * cpp: 403 active rules
[Debug - 09:37:00.368] Rule cpp:S5527 is enabled on the server, but not available in SonarLint
[Debug - 09:37:00.369] Rule cpp:S4830 is enabled on the server, but not available in SonarLint
[Debug - 09:37:00.369] * css: 23 active rules
[Debug - 09:37:00.369] Rule css:S4647 is enabled on the server, but not available in SonarLint
...
[Debug - 09:37:00.369] * c: 209 active rules
[Debug - 09:37:00.369] Rule c:S4830 is enabled on the server, but not available in SonarLint
[Debug - 09:37:00.369] Rule c:S5527 is enabled on the server, but not available in SonarLint
[Debug - 09:37:00.369] * go: 25 active rules
[Debug - 09:37:00.369] * js: 234 active rules
[Debug - 09:37:00.369] Rule javascript:S3785 is enabled on the server, but not available in SonarLint
...
[Debug - 09:37:00.369] Rule jssecurity:S5146 is enabled on the server, but not available in SonarLint
...
[stderr] Nov 06, 2023 9:37:01 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
[stderr] WARNING: Unmatched cancel notification for request id 103
...
[Debug - 09:37:00.371] Rule javascript:S6270 is enabled on the server, but not available in SonarLint
[Debug - 09:37:00.371] * py: 206 active rules
[Debug - 09:37:00.371] Rule pythonsecurity:S2091 is enabled on the server, but not available in SonarLint
...
[Debug - 09:37:00.371] Rule pythonbugs:S5633 is enabled on the server, but not available in SonarLint
[Debug - 09:37:00.372] * secrets: 7 active rules
[Debug - 09:37:00.372] * apex: 41 active rules
[Debug - 09:37:00.372] * docker: 7 active rules
[Debug - 09:37:00.372] * plsql: 132 active rules
[Debug - 09:37:00.372] * cs: 117 active rules
[Debug - 09:37:00.372] * java: 506 active rules
[Debug - 09:37:00.372] Rule javasecurity:S6173 is enabled on the server, but not available in SonarLint
...
[Debug - 09:37:00.373] * cobol: 74 active rules
[Debug - 09:37:00.373] * web: 28 active rules
[Debug - 09:37:00.373] * xml: 24 active rules
[Debug - 09:37:00.373] * php: 197 active rules
[Debug - 09:37:00.373] Rule phpsecurity:S2083 is enabled on the server, but not available in SonarLint
...
[Debug - 09:37:00.374] * terraform: 49 active rules
[Debug - 09:37:00.374] * cloudformation: 26 active rules
[Debug - 09:37:00.375] * ts: 223 active rules
[Debug - 09:37:00.375] Rule typescript:S1128 is enabled on the server, but not available in SonarLint
...
[Debug - 09:37:00.411] * yaml: 0 active rules
[Debug - 09:37:00.425] Start analysis
With that I can see now the issues in the Problems view.
Is there a way to switch off all not used/relevant languages ?