Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rely on SonarLint for Visual Studio Code for artifacts rather than the seperate JARs #21

Closed
thahnen opened this issue Dec 21, 2023 · 7 comments

Comments

@thahnen
Copy link

thahnen commented Dec 21, 2023

Hello,

this is Tobias from the SonarLint team at SonarSource. I noticed that you're downloading the Jar archives manually from either Maven Central or our hosted JFrog Artifactory.
First things first: The JFrog Artifactory links will soon stop working and therefore the follow-up idea for you (as I have no idea of Emacs Lisp and how to implement it myself) is to rely on the SonarLint for Visual Studio Code released artifacts, as they're in fact just ZIP archives (VSIX is just a fancy name I guess) always uploaded to GitHub after every release.

The language server is present in extension/server/sonarlint-ls.jar and the language analyzers can be found in extension/analyzers.
This way you can make use of every analyzer there is (C# should come in handy for #18) as you don't support all of them yet (Infrastructure as Code and C# via OmniSharp). The sonarcfamily.jar is the frontend for the C/C++ analyzer but indeed, for the analysis to work you have to be in connected mode.

This way you also only have to rely on one single source of truth - the GitHub download page. You may not like it, but the arch-enemy Vim is already relying on it via the Mason Registry.

Best regards and Happy Holidays,
Tobias

@thahnen thahnen mentioned this issue Dec 21, 2023
@thahnen
Copy link
Author

thahnen commented Dec 21, 2023

Supported languages on the SonarLint Language Server side (and therefore SonarLint for Visual Studio Code) can always be found at org.sonarsource.sonarlint.ls.EnginesFactory.java#STANDALONE_LANGUAGES.

@Sasanidas
Copy link
Collaborator

I see, I don't use sonarlint that much and this will require some development. But I'm sure that he @emacs-lsp team can help with that 👍

@Horrih
Copy link
Contributor

Horrih commented May 17, 2024

The language server is present in extension/server/sonarlint-ls.jar and the language analyzers can be found in extension/analyzers. This way you can make use of every analyzer there is (C# should come in handy for #18) as you don't support all of them yet (Infrastructure as Code and C# via OmniSharp). The sonarcfamily.jar is the frontend for the C/C++ analyzer but indeed, for the analysis to work you have to be in connected mode.

Thank you @thahnen and Sonar for showing support for a community plugin !
I use c++ sonar at work, and I would like to implement cfamily support in emacs as well.
I unzipped the vsix as mentioned and found a complete JRE + the analyzers, including cfamily.

If I understand correctly, cfamily only works in connected mode ? Do you know where I could find documentation on how to achieve this, or the corresponding source code in sonarlint's VSCode extension ?

Thanks !

@Horrih
Copy link
Contributor

Horrih commented May 20, 2024

The language server is present in extension/server/sonarlint-ls.jar and the language analyzers can be found in extension/analyzers. This way you can make use of every analyzer there is (C# should come in handy for #18) as you don't support all of them yet (Infrastructure as Code and C# via OmniSharp). The sonarcfamily.jar is the frontend for the C/C++ analyzer but indeed, for the analysis to work you have to be in connected mode.

Thank you @thahnen and Sonar for showing support for a community plugin ! I use c++ sonar at work, and I would like to implement cfamily support in emacs as well. I unzipped the vsix as mentioned and found a complete JRE + the analyzers, including cfamily.

If I understand correctly, cfamily only works in connected mode ? Do you know where I could find documentation on how to achieve this, or the corresponding source code in sonarlint's VSCode extension ?

Thanks !

After some testing on my side, I have found the following :

  • Unzipping the vsix works, and would simplify the logic around downloading separate jars
  • Sonarlint uses many LSP extensions, which are not yet implemented here, namely "sonarlint/shouldAnalyseFile", "sonarlint/listFilesInFolder", "sonarlint/filterOutExcludedFiles", "sonarlint/needCompilationDatabase"

As for CFamily support :

  • works even without the "connected" mode
  • seems to only require the provision of compile_commands.json to function

So, migrating to the "unzip the vsix" method has great potential to simplify the .jar management, and support for c/c++ would be easy. However beware of the numerous sonarlint extensions, some work will be needed here, at least on recent versions of sonarlint.

If I get enough time, I might be able to submit a PR in the upcoming weeks.

@thahnen
Copy link
Author

thahnen commented May 23, 2024

Hey @Horrih,

The documentation from SQ about CFamily can be found HERE. Yes, it is implemented for VSCode, but I cannot directly pinpoint it. Please take a look yourself.

For the rest of your assumptions. They're mostly right!

Once you do a PR, feel free to assign it to me for the SonarLint-specific logic; for Emacs, I honestly don't have a clue.

@Horrih
Copy link
Contributor

Horrih commented Jun 8, 2024

Thank you @thahnen , I have implemented PR #22 to add support for VSCode extension unzipping + cfamily support.

I also noticed that PR #20 seems to implement this as well. Let's hope it gets merged one way or the other.

I'll be testing out connected mode soon, it does not seem that hard to implement in its basic form.

@Sasanidas
Copy link
Collaborator

This sould have been fixed with #22

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants