Please provide
- Operating system: macOS 15.0
- SonarLint plugin version: v4.10.0
- Programming language you’re coding in: Swift
- Is connected mode used:
- Connected to SonarQube (and which version): 10.2.1
And a thorough description of the problem / question:
I am trying to analyze a Swift file from Visual Studio Code using connected mode, but Sonarlint doesn’t detect any of the issues that are actually detected by SonarQube.
How can I solve this issue?
Thanks!
Hi @miquellaboria,
Thanks for reaching out. The reason SonarLint doesn’t show Swift issues is that SonarLint for Visual Studio Code doesn’t support Swift.
Our docs feature the list of languages that are supported.
Best,
Tobias
Hi @tobias.hahnen,
Thank you for your response.
When I see the docs on this link: Connected Mode - VS Code
I had thought that SonarLint performed the analysis remotely, isn’t that so?
Thanks!
I had thought that SonarLint performed the analysis remotely, isn’t that so?
Not at all.
It’s a common misconception, but SonarLint performs a 100% local analysis based on the IDE’s contents, using the same analyzers as SonarQube and SonarCloud and only synchronizing issues found by the servers.
What led you to think that the analysis is performed on the server?
What made me think it was running on the server was the sentence where it indicates that in connected mode the plugin could analyze more languages and more issues, combining the rules of SonarLint with those of SonarQube.
Hey, thanks for sharing this insight!
Sending the code to the server for analysis would be a huge issue with unstable Internet connections, and it would require way too much computing power from the servers to handle the peak load.
What actually happens in connected mode is that SonarLint:
- Downloads the analyzer plugins from the server when required
- Synchronizes issues found by the most recent server analysis (including their status)
- Analyzes the code locally in the development environment
This is possible because SonarQube, SonarCloud, and SonarLint share a common (Java) runtime, with the plugin API acting as a Rosetta stone between the products.
The only exceptions are “injection-like” vulnerabilities (SQL injection, XSS): these rules cannot be run reliably in development environments (which may only have a subset of an application’s source code and lack the full context), so they are only synchronized from the server.
Ultimately, the source code only leaves the development environment when the developers decide to commit/push their code.
I hope this clarifies some of the architectural decisions that we made
.
Finally, to return to your initial question, although Swift is not yet supported in VSCode, we would be very happy to hear about your setup—e.g., what kinds of projects you are developing with Swift, and which extension(s) you use in VSCode. This could help our product managers evaluate the opportunity and priority of enabling support for Swift in VSCode.
1 Like