I'm trying to run StyleCop (4.7.47) via the gradle sonarrunner plugin on a Jenkins client. It runs fine, but for some reason it does not use my Settings.StyleCop file in which I disable a number of rules, so Sonar (3.7) reports violations that I am not interested in.
The c# project has the following structure:
/Root
Src/
Project1/...
Project2/...
MySolution.sln
Settings.StyleCop
build.gradle
My Settings.StyleCop file looks like this:
<StyleCopSettings Version="105">
<GlobalSettings>
<StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
</GlobalSettings>
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementDocumentationMustBeSpelledCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
</Analyzer>
</Analyzers>
</StyleCopSettings>
And the sonar properties that I specify for the sonarrunner gradle plugin are:
property "sonar.language" , "cs"
property "sonar.sources" , "Src"
property "sonar.dotnet.visualstudio.solution.file" ,"Src/MySolution.sln"
property "sonar.dotnet.key.generation.strategy", "safe"
property "sonar.sourceEncoding" , "UTF-8"
I have also tried specifying the sonar.stylecop.analyzers.settings property
, even though the Sonar FAQ mentioned that this cannot be used to specify active rules.
When I run StyleCop in VisualStudio it does use the correct rules.
Is there a way to verify where StyleCop gets its settings? Am I missing something obvious?
Any help appreciated.