Determine your technical debt using SonarQube - Bonus SonarLint extension configuration

Oct 4, 2017

TL; DR

You can display SonarQube static analysis results live in Visual Studio error and information console using the same rules set as the SonarQube project.

Installing the extension

Just go to https://www.sonarlint.org/VisualStudio/index.html and proceed with the installation.

Binding the Visual Studio solution to the SonarQube analysis

19.png

From the Team Explorer click SonarQube

20.png

Click on connect.

(if you obtain a certificate error, you must install the self-signed certificate of the SonarQube server on your machine)

To generate a personal access token, refer to the following documentation https://docs.SonarQube.org/display/SONAR/User+Token

Enter the token in the SonarQube login prompt as well as the server url

21.png

Double click on the SonarQube project that you want to bind to the Visual Studio solution

22.png

The errors detected by SonarQube static analysis now show up as a warning in the error console as well as in the intellisense.

JavaScripts Projects

There are cases where you’ll be only working on JavaScript/TypeScript using an editor lighter than the full version of Visual Studio, for example Visual Studio code. With SonarQube, the static analysis for JavaScripts projects, primarily relies on ESlint and TSlint. To have static analysis work from within your code editor, you only need to install the corresponding extensions and add a few configuration files in your source base.

If you want to analyze TypeScript, you’ll also need to install the TS Plugin, you’ll find all the details here https://github.com/Pablissimo/SonarTsPlugin


Last edited Apr 15, 2024 by Vincent Biret


Tags: