Skip to content
master
Switch branches/tags
Code

Latest commit

These are just disabled by default and depending on the project/company policy they should be enabled or not. Previously these types of rules were not imported at all, making them unavailable for tracking in SonarQube.
This was noticeable due to the fact that we now export the ReSharper rules via InspectCode with --no-buildin-settings to make them even with the ReSharper default. Some rules (e.g. TabsAreDisallowed) changed in that process to "DO_NOT_SHOW" which made them disappear after an update to this plugin >= 1.0.0.202013.

With this change we now support/provide C# rules with "DO_NOT_SHOW" severity because this is just a pre-set that the individual use could change and otherwise these rules would not even be available.

Issue #6
137063b

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Build Status

SonarQube ReSharper CLT Plugin

A SonarQube plugin for the ReSharper Command Line Tools.

Description

This plugin enables the analysis of C# and VisualBasic.NET source files contained in .NET projects using the output of the InspectCode JetBrains ReSharper Command Line Tool.

Properties declared/used by this plugin

Property Description
resharper.clt.solutionFile The path to the Visual Studio solution file (.sln) parsed by the InspectCode command line tool.
resharper.clt.cs.reportPath Used when analyzing C# projects. Defines the path to the XML report file generated by the InspectCode command line tool to be parsed by the plugin.
resharper.clt.vbnet.reportPath Used when analyzing VisualBasic.NET projects. Defines the path to the XML report file generated by the InspectCode command line tool to be parsed by the plugin.
resharper.clt.xsd.validation Enables XML Schema validation of the XML report file generated by the InspectCode command line tool. (not yet working)

How to use

A more in-depth guide on how to analyze projects that are built using MSBuild can be found in article Analyzing with SonarScanner for MSBuild of the official SonarQube documentation.

  1. Install the ReSharper Command Line Tools plugin (see Installing a Plugin - SonarQube Documentation - Doc SonarQube for more details)
  2. Enable at least one of the rules provided by the plugin in your quality profile (see Quality Profiles for more details)
  3. Open a command prompt, preferably the Developer Command prompt for Visual Studio
  4. Navigate to the root folder of the project/solution you want to build
  5. Execute the following steps:
    1. Begin the SonarQube analysis and provide the values for the required properties
      SonarScanner.MSBuild.exe begin /k:"sonarqube_project_key" /n:"sonarqube_project_name" /d:sonar.login="%SONAR_LOGIN_TOKEN%" /d:resharper.clt.cs.reportPath="inspectcode_result.xml" /d:resharper.clt.solutionFile="%SOLUTION_FILE%"
    2. Build the project
      msbuild.exe "%SOLUTION_FILE"
    3. Run ReSharper Command Line Tool InspectCode.exe
      inspectcode.exe /output="resharper.xml" "%SOLUTION_FILE%"
    4. End the SonarQube analysis, which will upload the issues to the server
      SonarScanner.MSBuild.exe end /d:sonar.login=%SONAR_LOGIN_TOKEN%

Configuration

It's possible to override the SonarSeverity for particular rules by providing a custom sonarqube_rule_overrides.xml. This can be either located in the base folder of the application or at a location specified with the environment variable: SONAR_PLUGIN_INSPECTCODE_OVERRIDEFILE=C:\config\my-sonar-inspectcode-rule-override.xml.

Updating the plugin for a new ReSharper version

The following command can be used to dump the rules into an XML file that is used by this plugin.

inspectcode.exe --dumpIssuesTypes --output="inspectcode_issue_definitions.xml" --no-buildin-settings 

After dumping the new ruleset, it is mandatory to check all the new rules and adjust the sonarqube_rule_overrides.xml accordingly, to account for any rules that should be categorized differently by default.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.