Sonarqube 5.4 Standard Rule for C #

I use SonarQube 5.4 to analyze my own C # code, the analysis works as I expected. Now I have written some custom rules, one of which uses StyleCop and the other FxCop to run my code, but I can not find how to import this custom rule into SonarQube. I emphasize that I am using SonarQube 5.4 with the C # 5.1 plugin. In my settings, the "rules" folder does not exist. Instead, I can find:

sonar-fxcop-library-1.3.jar in / opt / sonarqube -5.4 / data / web / deploy / plugins / csharp / META-INF / lib as well as sonar-style-plugin-1.1 in / opt / sonarqube -5.4 / extensions / plugins.

Can anyone help me import my custom rules into a SonarQube installation?

+4
source share
3 answers

FxCop Integration : Add Template for custom FxCop rulesto SonarQube (fxcop: CustomRuleTemplate) specifying CheckIdyour custom FxCop rule. [edit] FxCop rules are now covered by the sonar-fxcop plugin .

Integration StyleCop : outdated because StyleCop does not rely on Roslyn.

+3
source

, http://sonarqube-archive.15.x6.nabble.com/FxCop-Custom-Rules-option-unavailable-on-sonarqube-5-0-td5032660.html . , Rules, CheckId. - . , CheckId, sonarScanner MSBuild , - SonarQube , . , . - ?

0

# Sonar. :

1. Roslyn : Roslyn . , . , , - Roslyn Live Code Analyzer API. .nupkg bin .
, your_project_name.version, , AnalyzerExample.1.0.6971.18074, - .

2. SonarQube Roslyn SDK SonarQube, Roslyn. , SDK SonarQube. , . JAR.

RoslynSonarQubePluginGenerator.exe /a:analyzerexample 

XML . xml , jar, :

RoslynSonarQubePluginGenerator.exe /a:analyzerexample /rules:rules.xml

jar analysisrexample-plugin-1.0.6971.18074. , . , 1.

3. Use the generated jar file as a plug-in: copy the plug-in (jar file) created in step 1 to the SonarQube extension folder. Reboot the Sonar server. Log in to the server and then you will see the added rule in the section of the quality profile, in the list of recent rules. Click on this rule to activate it by adding it to some quality profile.

0
source

All Articles