How to get the most out of SonarLint?

Installation

You need Java 8 (JRE).

Install SonarLint like any other extension, from the VS Code marketplace, directly from your IDE or from your Web browser. Once installed, SonarLint is enabled by default.

SonarLint should automatically find the JRE installed on your computer but you can also explicitly specify the path where it is by using the ‘sonarlint.ls.javaHome’ variable in VS Code settings. For example:

{
  "sonarlint.ls.javaHome": "C:\Program Files\Java\jre1.8.0_131"
}

Analyze your code

There’s nothing to do! Analysis is automatically triggered when you open a file or simply when you work on the code. Issues are highlighted in the editor and listed in the standard VS Code “Problems” panel.

Connected mode

Connecting SonarLint to SonarQube or SonarCloud is not yet available.

Rule configuration

SonarLint uses the rules from the default quality profiles. If you feel that a rule isn’t valuable for you, please report it in the SonarLint Google Group. We’d like everyone to have the best out-of-the-box experience, so we might tune such a rule or disable it by default.

File and issue exclusion

By default, all the files in an open project that are written in recognized languages are analyzed.

Issue highlighting

SonarLint issues are reported as warnings and errors. You can change the way issues are displayed in VS Code settings, using the “workbench.colorCustomizations” variable. For example:

"workbench.colorCustomizations": {
     "editorError.foreground": "#00ff00",
     "editorWarning.foreground": "#00ff00"
}

Sonarlint logs

The SonarLint output can be useful to understand some technical issues. You can open it from the standard VS Code “Output” panel.

How to contribute?

SonarLint for Visual Studio Code is open source under the LGPL v3 license. You can fork us on GitHub, and submit Pull Requests. Feel free to fix bugs or to implement new features.