将自定义FxCop规则导入声纳

时间:2014-07-04 07:57:20

标签: .net sonarqube fxcop

请帮助我,

自定义装配: C:\ Program Files(x86)\ Microsoft FxCop 1.35 \ Rules \ my \ DOTNET.dll

规则文件: d:\ SONAR \扩展\规则\的FxCop \ DOTNET.xml

我点击恢复配置文件并备份此文件:export.xml - 导入后为0规则

有什么问题?

感谢您的帮助。 大卫·莫尔坎

这是DOTNET.xml

<rules>
<rule key="DOTNETCodeWritingGuidlinesForClassesFinalizerWithIDisposable">
<name>
<![CDATA[ La méthode doit avoir une casse correct. ]]>
</name>
<configKey>
<![CDATA[
DOTNETCodeWritingGuidlinesForClassesFinalizerWithIDisposable@C:\Program Files (x86)\Microsoft FxCop 1.35\Rules\my\DOTNET.dll
]]>
</configKey>
<category name="Maintainability"/>
<description>
<![CDATA[ La méthode doit avoir une casse correct. ]]>
</description>
</rule>
</rules>

这是export.xml

<!--  Generated by SonarQube  -->
<profile>
    <name>Sonar way2</name>
    <language>cs</language>
<FxCopProject Version="1.36">
<ProjectOptions>
<SharedProject>True</SharedProject>
<SaveMessages>
<Project NewOnly="False" Status="Active, Excluded"/>
<Report NewOnly="False" Status="Active"/>
</SaveMessages>
<ProjectFile Deterministic="True" SaveByRuleGroup="" DefaultRuleCheck="True" DefaultTargetCheck="True" Compress="True"/>
<EnableMultithreadedLoad>True</EnableMultithreadedLoad>
<EnableMultithreadedAnalysis>True</EnableMultithreadedAnalysis>
<SourceLookup>True</SourceLookup>
<AnalysisExceptionsThreshold>10</AnalysisExceptionsThreshold>
<RuleExceptionsThreshold>1</RuleExceptionsThreshold>
<Spelling Locale="en-US"/>
<OverrideRuleVisibilities>False</OverrideRuleVisibilities>
<CustomDictionaries SearchProjectDir="True" SearchUserProfile="True" SearchFxCopDir="True"/>
<IgnoreGeneratedCode>False</IgnoreGeneratedCode>
</ProjectOptions>
<Rules>
<RuleFiles>
<RuleFile AllRulesEnabled="False" Enabled="True" Name="C:\Program Files (x86)\Microsoft FxCop 1.35\Rules\my\DOTNET.dll">
<Rule Enabled="True" Name="DOTNETCodeWritingGuidlinesForClassesFinalizerWithIDisposable" SonarPriority="major"/>
</RuleFile>
</RuleFiles>
</Rules>
</FxCopProject>
</profile>

1 个答案:

答案 0 :(得分:0)

FxCop 1.35非常陈旧,SonarQube C#插件不再正式支持,即使可能仍然有效。有关如何实施FxCop自定义规则的详细信息,请参阅http://blogs.msdn.com/b/codeanalysis/archive/2010/03/26/how-to-write-custom-static-code-analysis-rules-and-integrate-them-into-visual-studio-2010.aspx

自C#3.2插件以来,再次支持自定义FxCop规则。要使用它们,只需复制规则模板&#34;模板以用于自定义FxCop规则&#34; (键CustomRuleTemplate)根据需要多次,并指定每个自定义rume的CheckId

如果您仍在使用C#插件的2.1版,则可能需要在升级到3.x之前阅读http://docs.codehaus.org/x/EIBMDg