SonarQube configure with VS code (1.30)

Is a Sonarqube is support to visual studio code (version 1.30) if yes then do we need to install sonar lint extension as well. if no then which version of visual studio code it is supported.

Thanks in advance

You can install the SonarLint extension in VSCode, and connect it to a SonarQube server to benefit from connected mode (custom, centralized quality profile).

Can we use Sonarqube in Visual Studio Code (Version 1.30 and higher) independently on Windows 10?

SonarQube, Sonarlint and Sonar scanner are depending on each other and mandatory to install

SonarQube is not something you use in a code editor. It’s a server software with a web interface.

A scanner is a software you run in the directory of your source code, to connect to a SonarQube server. It downloads analyzers and the quality profile to use, runs the analyzers, and uploads results to the SonarQube server.

SonarLint is what you use in a code editor. It exists for VSCode, IntelliJ, Eclipse, and Visual Studio. Yes you can use it without SonarQube. SonarLint doesn’t use a scanner at all.

1 Like

Many Thanks

We have installed the Sonar lint in visual studio Code on my Windows machine, but it won’t work.
It would be great if you provide step or link to install Sonar lint for Visual studio code.

I suggest to never use this phrase without providing further details. This phrase doesn’t give us any clues to investigate.

You could for example provide a snippet of code, in some language X, where you expected issue Y to be raised, but it’s not raised. Or error messages that pop up. Or some other clue that might help understand your situation.

Apologize
Please find below the steps followed by me.

  1. Open VS code and add SonarLint extension.
  2. Reload the vs code.
  3. Got the two error
    i. Sonar server not running
    ii. Java run time could not be located install it set the location

image

  1. I have install java 11.0 on my machine
  2. I have write some in one of the .ts file but no luck.

image

Could you please review above steps and suggest what is issue or any step missing by me

hi @janos good summary, but I have a question, if I can use sonarlint without sonarqube why you provide settings to connect sonarqube server? for sync the rules?

If I use sonarlint java out of box, then by default I use the default rules you set right?

@huahuayu I think your question has nothing to do with this thread. I think it makes more sense to create a new thread for your question.

Hi @Sunil21, I’m sorry I completely forgot about this thread.

We haven’t tested SonarLint for VSCode with Java 11, and I’m afraid this is not supported yet. Please try Java JRE 10, that should work.

@Sunil21 I did a bit more digging. Although we haven’t announced officially supporting Java 11, it appears to be working just fine. I suspect your problem is more about specifically analyzing TypeScript code. Please confirm that is the case. Also that you are able to analyze other languages, for example .js files.

For a simple sanity check to confirm that ts is getting analyzed, try this snippet:

if (x && x) {
    // ...
}

This should raise an issue.

A post was split to a new topic: Configuring SonarLint in VSCode