{"id":15635,"date":"2016-04-18T14:10:22","date_gmt":"2016-04-18T07:10:22","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/?p=15635"},"modified":"2019-02-14T17:34:06","modified_gmt":"2019-02-15T01:34:06","slug":"sonarlint-for-visualstudio-2-1-released-brings-consistency-with-msbuild-navigation-to-sonarqube-and-notifications","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/sonarlint-for-visualstudio-2-1-released-brings-consistency-with-msbuild-navigation-to-sonarqube-and-notifications\/","title":{"rendered":"SonarLint for VisualStudio 2.1 released, brings consistency with MSBuild, navigation to SonarQube and notifications"},"content":{"rendered":"<p>&lt;<\/p>\n<p>p>A few weeks ago, we released SonarLint for Visual Studio 2.0 and you discovered the <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2016\/03\/17\/bind-a-visual-studio-solution-to-a-sonarqube-project-provisions-and-configures-roslyn-analyzers\/\" target=\"_blank\">SonarQube connected mode<\/a> enabling customers to align the definition of the quality of a Visual Studio solution with a quality profile in SonarQube<\/p>\n<p>&lt;<\/p>\n<p>p>Last Friday, we released <a href=\"http:\/\/www.sonarsource.com\/2016\/04\/15\/sonarlint-for-visual-studio-2-1-released\/\" target=\"_blank\">SonarLint for Visual Studio 2.1<\/a>, improving this \u201cconnected mode\u201d experience in 3 directions:<\/p>\n<ul>\n<li><a href=\"#consistency\">Consistency with the SonarQube Scanner for MSBuild<\/a><\/li>\n<li><a href=\"#navigation\">Navigation to SonarQube<\/a><\/li>\n<li><a href=\"#notifications\">Notifications in case of mis-alignments between the definition of the quality in the IDE, and the one in SonarQube<\/a><\/li>\n<\/ul>\n<p>&lt;<\/p>\n<p>p>Let\u2019s see these 3 points.<\/p>\n<h4 id=\"consistency\">Consistency with the SonarQube Scanner for MSBuild<\/h4>\n<p>&lt;<\/p>\n<p>p>We wanted to make sure that users get the same results in the IDE as they get during a continuous integration build. This has not been the case so far, because Roslyn analyzers were provisioned and configured for every MSBuild project, even for test projects and for projects explicitly excluded from the analysis.<\/p>\n<p>&lt;<\/p>\n<p>p>Now, when we bind a solution to SonarQube using the bind command, no Roslyn analyzer NuGet packages are provisioned for test projects, or for projects excluded from the build.<\/p>\n<p>&lt;<\/p>\n<p>p>There are still a few differences, though (the IDE doesn\u2019t support file-level exclusions, and the logic used to detect generated code isn\u2019t exactly the same). We\u2019ll improve them with time.<\/p>\n<p>&lt;<\/p>\n<p>p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image00113.png\"><img decoding=\"async\" title=\"clip_image001\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/clip_image001_thumb10.png\" width=\"371\" height=\"864\"><\/a><\/p>\n<h4 id=\"navigation\">Navigation to SonarQube<\/h4>\n<p>&lt;<\/p>\n<p>p>It is now possible to navigate to SonarQube directly from the Team Explorer.<\/p>\n<ul>\n<li>Right-clicking on a SonarQube project and choosing the <b>View in SonarQube<\/b> command opens a browser where you will see the dashboard for the SonarQube project&nbsp; directly<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image0028.png\"><img decoding=\"async\" title=\"clip_image002\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/clip_image002_thumb5.png\" width=\"373\" height=\"192\"><\/a><\/p>\n<ul>\n<li>You can also right-click on the tree nodes corresponding to the SonarQube server and choose <b>Browse<\/b>, which will open a browser on the portal itself<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image0036.png\"><img decoding=\"async\" title=\"clip_image003\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image003\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/clip_image003_thumb3.png\" width=\"375\" height=\"223\"><\/a><\/p>\n<h4 id=\"notifications\">Notifications in case of quality definition discrepancies <\/h4>\n<p>&lt;<\/p>\n<p>p>Once your solution has been bound to a SonarQube quality profile, nothing prevents you from changing the rulesets on a given project if you wish. For example, in the example below, I\u2019ve deactivated rule S1006 and activated rule S100.<\/p>\n<p>&lt;<\/p>\n<p>p>This only overrides the ruleset of the project, which itself inherits from the global ruleset in the solution, corresponding to the quality profile.<\/p>\n<p>&lt;<\/p>\n<p>p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image0056.jpg\"><img decoding=\"async\" title=\"clip_image005\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image005\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/clip_image005_thumb6.jpg\" width=\"608\" height=\"242\"><\/a><\/p>\n<p>&lt;<\/p>\n<p>p>In the previous version, when I went to the Team Explorer SonarQube tab, right clicked on a project and selected <b>Update<\/b> (which used to be named Sync, BTW) to update my local definition of quality from SonarQube\u2019s quality profile, the local rulesets were not touched, and therefore you could have a definition of the quality lower than the one defined in SonarQube.<\/p>\n<p>&lt;<\/p>\n<p>p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image0069.png\"><img decoding=\"async\" title=\"clip_image006\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image006\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/clip_image006_thumb6.png\" width=\"425\" height=\"184\"><\/a><\/p>\n<p>&lt;<\/p>\n<p>p>Now, in such a case, I get the following warning in Team Explorer:<\/p>\n<p>&lt;<\/p>\n<p>p><i>The applied ruleset is weakening the SonarQube quality profile in one or more projects. See output window (General) for more details. <\/i><i><font color=\"#0000ff\">Click here<\/font><\/i><i> to fix automatically<\/i><\/p>\n<p>&lt;<\/p>\n<p>p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image00812.jpg\"><img decoding=\"async\" title=\"clip_image008\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image008\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/clip_image008_thumb12.jpg\" width=\"608\" height=\"415\"><\/a><\/p>\n<p>&lt;<\/p>\n<p>p>I\u2019m now warned about the rules that are less strict. (it\u2019s fine to have a stronger definition as you may wish to hold to a higher bar for your own work)<\/p>\n<p>&lt;<\/p>\n<p>p>If I want, I can let SonarLint for Visual studio fix this mis-alignment by clicking the <b>Click here<\/b> link in the Team Explorer SonarQube\u2019s task. It will only touch the rules in the projects rulesets, which are weaker (here S1006). The stronger ones will be left unchanged (S100 is not mentioned)<\/p>\n<p>&lt;<\/p>\n<p>p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image01014.jpg\"><img decoding=\"async\" title=\"clip_image010\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"clip_image010\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/04\/clip_image010_thumb13.jpg\" width=\"608\" height=\"184\"><\/a><\/p>\n<p>&lt;<\/p>\n<p>p>Here is the resulting ruleset for the project after the fixes have been applied:<\/p>\n<h4>In closing<\/h4>\n<p>We look forward to hearing from you. Please send us your feedback by asking some questions on <a href=\"http:\/\/stackoverflow.com\/questions\/tagged\/sonarlint\">StackOverflow<\/a> or directly by reporting any bugs you find on the <a href=\"https:\/\/groups.google.com\/forum\/#!forum\/sonarlint\">SonarQube Google Group<\/a>. You can also submit suggestions for new features, for example, on <a href=\"http:\/\/visualstudio.uservoice.com\/\">User Voice<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt; p>A few weeks ago, we released SonarLint for Visual Studio 2.0 and you discovered the SonarQube connected mode enabling customers to align the definition of the quality of a Visual Studio solution with a quality profile in SonarQube &lt; p>Last Friday, we released SonarLint for Visual Studio 2.1, improving this \u201cconnected mode\u201d experience in [&hellip;]<\/p>\n","protected":false},"author":112,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,1,249],"tags":[],"class_list":["post-15635","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-community","category-devops","category-open-source"],"acf":[],"blog_post_summary":"<p>&lt; p>A few weeks ago, we released SonarLint for Visual Studio 2.0 and you discovered the SonarQube connected mode enabling customers to align the definition of the quality of a Visual Studio solution with a quality profile in SonarQube &lt; p>Last Friday, we released SonarLint for Visual Studio 2.1, improving this \u201cconnected mode\u201d experience in [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/15635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/112"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=15635"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/15635\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=15635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=15635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=15635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}