SonarLint 2.2 for Visual Studio improves the connected mode

In the continuation of SonarLint 2.1 for Visual Studio, last week, SonarSource and Microsoft released SonarLint 2.2, providing in-IDE analysis results consistent with analysis builds. Here is a description of the scenarios covered by these new improvements:

Notifications when the quality of the solution is not consistent with the Quality profile

Until now, you had no automated way of knowing when the quality profile of the SonarQube project bound to your solution had been changed since you had synced. If you were aware that the quality profile had changed, you could go to the SonarQube tab in Team Explorer, right click on the project and perform a sync.

From SonarLint 2.2 for Visual Studio, we have added notifications so that when you open the solution you immediately know of a quality definition change:

When opening a solution which is bound to a SonarQube project, you will now be notified by a Gold Bar message in the Error list if a resync is needed.

clip_image002

Note that when upgrading from a previous version of SonarLint for Visual Studio, you will be given the choice to enable this notification. Just click the “Update” button, and you are ready to be notified. If you don’t click Update, you will be notified each time (or until you update the binding from the SonarLint tab in Team Explorer)

clip_image004

Excluding project from SonarQube analysis

Until now, if you wanted to exclude an MSBuild project from a SonarQube analysis, you had to edit the project file (for example a .csproj file), and add a build property named SonarQubeExcluded. If you are interested in the details, the documentation is in Excluding Artifacts from the Analysis

In the same way, MSTest projects are automatically recognized (based on their project type) as test projects. But there are so many test frameworks that sometimes a test project is not recognized as such. It was possible to force the SonarQube analysis to consider them by using the SonarQubeTestProject build property as explained in Miscellaneous Advanced Usages.

You gave us the feedback that this was too difficult, and therefore, it is now possible to edit the SonarQube exclusion MSBuild properties and nature of project (test project) through the UI in Visual Studio.

clip_image006

SonarLint for Visual Studio writes information in its own tab in the output window

Project binding now gives feedback on why projects are not bound (when they are excluded or test projects), and the information from this VS extension now goes to its own tab in the Output window (SonarLint)

clip_image008

As ever, we welcome comments and feedback. If you have a support question, head over to StackOverflow and have a look at the questions tagged with sonarlint to see if there is already a solution there, and if not, please ask. Bugs can be reported via the SonarQube Google Group.