Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Name.Net ReSharper
Latest version0.1 ( Unreleased )
Requires SonarQube version3.0 or higher ( check version compatibility ) (version compatibility chart will be available soon)
Download(release not yet available – try the CI builds instead)
LicenseGNU LGPL 3
DevelopersJohn M. Wright (Twitter) (Blog)
Issue tracker

Description / Features

The .NET ReSharper plugin supports using the free JetBrains ReSharper command line code inspection tool "InspectCode" as a source for .NET-based static analysis issues. ReSharper is an extremely popular commercial plugin to the Visual Studio IDE for .NET development and this plugin allows users to have a parallel experience in the IDE and in SonarQube when it comes to code analysis results.

The plugin supports reusing existing reports generated by the ReSharper "inspectcode.exe" tool, or, if the user has separately installed the tools, it supports running the analysis as part of the SonarQube runner.  This mirrors the process used for the other .NET ecosystem tools such as FxCop and StyleCop.  The JetBrains tools are not bundled with the plugin.  


What You Can Expect To See

Something like this in Visual Studio using ReSharper:

Will turn into this in SonarQube:





  1. Install the .NET and C# plugins following their installation instructions
  2. Install the sonar-dotnet-resharper-plugin from the Update Center or download them (link at top of this page) into the SONARQUBE_HOME/extensions/plugins directory
  3. Restart the SonarQube server
  4. Modify Your Project's Quality Profile (see below)

Modify Your Project’s Quality Profile

If you install the sonar-dotnet-resharper-plugin on a clean system where you have not modified the “Sonar way” Quality Profile, then all of the new ReSharper-based rules will be included and enabled immediately. However, if you have modified that profile or have your own custom profile(s), you will need to enable the ReSharper rules for that profile after installing the plugin. To do this, go into the SonarQube web UI, click the “Quality Profiles” link in the header bar, and choose the profile you wish to include ReSharper results.

In the filter boxes, choose “ReSharper” in the Repository field and “Any” from the Activation field and click "Search". I expect you’ll see a list of approx 650 rules, all disabled. In the upper right corner of the results list is a “Bulk Change” option. Choose “Activate all”. This will (immediately) activate all of the ReSharper rules for this profile.

Running an Analysis

The SonarQube Runner is recommended for analyzing .NET solutions, but Maven can also be used.

Now, add the following properties to your file(s) based on which scenario you wish to follow.

Reuse Report

Where the value of sonar.resharper.reports.path is the path to the ReSharper results file relative to each project file, as an absolute path, 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 requiring the same relative path be used for all projects. As such, if your filesystem layout has project files at different depths relative to the results file, you should consider using an absolute path or one of the Path Patterns.


Let SonarQube Drive the Execution of ReSharper
Deactivating the plugin


The run the analysis following the instructions provided for the .Net ecosystem plugins


Reuse Report vs Run During Analysis


The ReSharper analysis can be very time consuming for large solutions with many projects, sometime taking multiple hours to run, especially if the cache has to be rebuilt, so users should favor the reuseReport mode when possible. This reduces the number of times the analysis is executed, since running it during the sonar-runner will analyze each project separately, adding significant analysis time, even with heavy caching in the ReSharper tool. This also allows the user to fine-tune the ReSharper analysis parameters via command-line flags.

To use the reuseReport option you’ll need to download the ReSharper command line tools from JetBrains and use the inspectcode.exe utility to analyse your solution before executing sonar-runner. There are several command line options for the tool, but at minimum, you’ll need this:

 inspectcode.exe -o=resharper-results.xml YourSolutionName.sln 

Where -o=resharper-results.xml will write the results into the file name you provide. Note: by default (without the -o argument), inspectcode will write the file to the temp directory. You’ll need this file to provide to the plugin.

A Note About Rule Severity

ReSharper users a four-tier severity, while SonarQube uses a five-tier system. I have mapped the ReSharper values like this:



Do Not ShowInfo

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 show, 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 downgrade a lot of the ‘Critical’ rules to ‘Major’ and a lot of 'Info' to be turned off.

Known Issues / Limitations

The ReSharper command line tools are fairly new and still have a few kinks to work out.  Versions before 8.1 are not recommended, as several key issues were addressed in the 8.1 release.

Inconsistent results from inspectcode

From one run to the next, you may get a different list of rule violations from ReSharper, even without code changes: See UPDATE: This has been marked as "fixed" as of version (2013-11-30)


"Sonar.UnknownIssueType" Violation

SonarQube requires that the rule database be populated up front, at server start. ReSharper provides a list of possible violation types for their tool via the `/dumpIssuesTypes` argument, and the plugin will populate the SonarQube rule repository using these values (as of the plugin's build).  However, as new versions come out, or you add your own ReSharper plugins to generate new IssueTypes,  it’s 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 runner’s log) and generate a "Sonar.UnknownIssueType" violation with instructions on how to add the rule information to the 'ReSharper custom rules' property in the Settings UI.  After adding that setting and restarting SonarQube, future analysis runs will support those IssueTypes.


Other File Types

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 for a given project. For .xaml and other files, the plugin attempts to report the violation against the file, but they may end up attached to the project instead. In either case, the source code for the .xaml or other unsupported file type will not be imported into SonarQube.

Change Log

(coming soon)



Key Summary T Created Updated Due Assignee Reporter P Status Resolution
SONARPLUGINS-3355 Empty/default RunMode causes NPE Bug Dec 23, 2013 Jan 20, 2014 John Wright John Wright Blocker Closed Fixed
SONARPLUGINS-3331 pom uses incorrect groupId Bug Dec 06, 2013 Dec 12, 2013 John Wright John Wright Blocker Closed Fixed
SONARPLUGINS-3305 make wiki links clickable Improvement Dec 03, 2013 Dec 03, 2013 John Wright John Wright Major Closed Fixed
SONARPLUGINS-3269 provide means to enable/disable violation creation for files ignored by .net plugin Bug Nov 20, 2013 Dec 03, 2013 John Wright John Wright Major Closed Fixed
SONARPLUGINS-3261 RunMode values not respected Bug Nov 16, 2013 Dec 03, 2013 John Wright John Wright Major Closed Fixed
SONARPLUGINS-3234 When using 'reuseReport' mode, plugin should verbosely fail if file not found Bug Oct 31, 2013 Dec 03, 2013 John Wright John Wright Major Closed Fixed
SONARPLUGINS-3233 report path property behavior differs from other .NET plugins Improvement Oct 31, 2013 Dec 12, 2013 John Wright John Wright Major Closed Fixed
SONARPLUGINS-3202 Utilize new inspectcode "dumpIssueTypes" flag to populate rules Improvement Oct 28, 2013 Dec 03, 2013 John Wright John Wright Major Closed Fixed
SONARPLUGINS-3200 File paths associated with violations are incorrect (duplicate project folder) Bug Oct 24, 2013 Dec 03, 2013 John Wright John Wright Critical Closed Fixed

  • No labels