Message-ID: <1532118006.655.1406224223331.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_654_574431553.1406224223330" ------=_Part_654_574431553.1406224223330 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Description / Features
The .NET ReSharper plugin supports= using the free JetBrains ReSharper command line co= de inspection tool "InspectCode" as a source for .= NET-based static analysis issues. ReSharper is an extremely popular com= mercial plugin to the Visual Studio IDE for .NET development and this plugi= n allows users to have a parallel experience in the IDE and in SonarQube wh= en it comes to code analysis results.
Something like this in Visual Studio using ReSharper:
Will turn into this in SonarQube:
If you install the sonar-dotnet-resharper-plugin on a clean system where= you have not modified the =E2=80=9CSonar way=E2=80=9D Quality Profile, the= n all of the new ReSharper-based rules will be included and enabled immedia= tely. However, if you have modified that profile or have your own custom pr= ofile(s), you will need to enable the ReSharper rules for that profile afte= r installing the plugin. To do this, go into the SonarQube web UI, click th= e =E2=80=9CQuality Profiles=E2=80=9D link in the header bar, and choose the= profile you wish to include ReSharper results.
In the filter boxes, choose =E2=80=9CReSharper=E2=80=9D in the Repositor= y field and =E2=80=9CAny=E2=80=9D from the Activation field and click "= ;Search". I expect you=E2=80=99ll see a list of approx 650 rules, all = disabled. In the upper right corner of the results list is a =E2=80=9CBulk = Change=E2=80=9D option. Choose =E2=80=9CActivate all=E2=80=9D. This will (i= mmediately) activate all of the ReSharper rules for this profile.
Now, add the following properties to your sonar-project.properties file(= s) based on which scenario you wish to follow.
Where the value of
/code> is the path to the ReSharper results file relative to each project file, as an absolute path, <=
/span>or utilize any of the Path Patterns supported by the =
.Net ecosystem plugins. This has the current limitation (same =
as the FxCop and other sonar-dotnet plugins) of requiri=
ng the same relative path be used for all projects. As such,=
if your filesystem layout has project files at different depths relative t=
o the results file, you should consider using an absolute path or one of th=
e Path Patterns.
Where the value of sonar.resharper.dotSettings.path (optional) is t= he path to your ReSharper settings customization file (created by the ReSha= rper "Options" dialog in Visual Studio). Note: If the DotSettings= file exists in the same folder as the .sln file and has the same base= name as the solution (ex: MySolution.sln and MySolution.DotSettings), ReSh= arper will automattically use the file without having to provide it in this= property. Providing a value here will override the name-based D= otSettings file, which will then not be used.
And the value of sonar.reshaper.additionalArguments is added to the insp= ectcode command line. Values can be determined using the /help parameter to= inspectcode and here: http://confluence.jetbrains.com/display/NETCOM/Introducing+InspectCode. The /properties argument can be used to provide MSBuild values and= the undocumented /plugin can be used to include a local ReSharper plugin.<= /p>
ReSharper user a four= -tier severity, while SonarQube uses a five-tier system. The plugin has= mapped the ReSharper values like this in the initial rules profile loading= :
|Do = Not Show||Inf= o|
While some of the ReSharper rules are marked as "Do Not Show" = by default, the plugin maps them to "Info" so that you can modify= their visibility via the Quality Profile. If you want them to not sh= ow, disable the rules in the Quality Profile. You can, of course, change any of these levels for any rule= using the Quality Profile, and I fully expect most people will want to dow= ngrade a lot of the =E2=80=98Critical=E2=80=99 rules to =E2=80=98Major=E2= =80=99 and a lot of 'Info' to be turned off.
SonarQube requires that the rule database be populated up front, at serv= er start. ReSharper provides a list of possible violation types for their t= ool via the "/dumpIssuesTypes" argument, and the plugin will popu= late the SonarQube rule repository using these values (as of the plugin's b= uild). However, as new versions come out, or you add your own ReSharp= er plugins to generate new IssueTypes, it=E2=80=99s possible that you= will have violations in your code that the plugin did not know about when = the server started, so cannot import into SonarQube appropriately. When the= plugin comes across one of these, it will write a log statement (to the ru= nner=E2=80=99s log) and generate a "Sonar.UnknownIssueType" viola= tion with instructions on how to add the rule information to the 'ReSh= arper custom rules' property in the Settings UI. After adding that se= tting and restarting SonarQube, future analysis runs will support those Iss= ueTypes.
While the ReSharper tools support = the full .Net stack, including .xaml and other file types, the sonar-dotnet= API does not currently support more than one language (C# or VB.net) for a= given project. For .xaml and other files, the plugin attempts to report th= e violations against every file ReSharper reports, but they will show up in= SonarQube without source code. Additionally, there are a handful of = situations where they may= end up attached to the project instead.
You can configure the plugin to on= ly report violations against files that are supported by the dotnet plugins= using the 'sonar.resharper.includeAllFiles' property.