Use SonarLint to work on your technical debt in Visual Studio

SonarQube is a really great solution to monitor and track your technical debt over time. But wouldn’t it be great if the developer could already see in Visual Studio the impact that his commit will have to the sonar dashboard? If you use Visual Studio 2015 and the C# Plugin for SonarQube you can do this with the extension SonarLint.

The extension depends on the latest version of the C# Plugin – so make sure that you have the latest version (5.2) installed.

In Visual Studio install the extension in the “Extensions and Updated” dialog.

Install SonarLint Extension

This adds a new Tile ‘SonarQube’ to your Team Explorer.

SonarLint Menu in Team Explorer

You can use this tile to connect to your SonarQube instance.

Configure SonarLint Connection

Once connected you can bind your current solution to a project from the SonarQube instance.

Bind Solution ti Sonar Project

Now all the Errors and Warnings from your SonarQube project will show up in the error window in Visual Studio.

Sonar Error in Visual Studio

SonarLint uses Roslyn to perform the analysis so that you can use all tooling that you get from the roslyn compiler. You can suppress the message from within the code if you like.

Roslyn and Suppresions

You also can leverage the new features from the static code analysis in Visual Studio like only showing messages for the changed documents.

Filter Errors

So that’s it. A really small extension with a very big impact. I’ve always been a big fan the FxCopy and the static code analysis – But I’ve always missed a central point to manage the rules and to monitor the output over time. SonarQube is perfect for that – but without a Visual Studio integration it was not a complete solution. SonarLint closes that gap and integrates the Visual Studio toolchain perfectly with SonarQube.

4 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s