2012-05-10 30 views
0

我们正在使用FxCop Integration VS Extension将FxCop与VS 2010 Professional进行集成,以便进行代码分析。我们已经看到,使用在FxCop中配置的所有默认规则集,我们得到了大量的报告点,这些点可以很好地满足但不一定严格违反最佳实践,或者在大多数情况下可以不做。是否有任何规则列表,实质上是FxCop中所有规则的一个子集,人们通常使用这些规则为基于Web的项目进行代码分析,这些项目可以被认为是必须具备的。我们轻松搜索,但无法获得单数(关于忽略基于个人选择的特定规则的讨论遍布整个Web)资源,其中列出了社区通常遵循的基于web的asp.net/C#项目。ASP.NET Web应用程序的FxCop规则列表子集

回答

0

其实我正在使用这个使用TeamCity集成,但规则应该是相同的。尝试下面一次:

<?xml version="1.0" encoding="utf-8"?> 
<FxCopProject Version="1.36" Name="testApplication"> 
<ProjectOptions> 
    <SharedProject>True</SharedProject> 
    <Stylesheet Apply="False">\tools\fxcop\Xml\FxCopReport.xsl</Stylesheet> 
    <SaveMessages> 
    <Project Status="Excluded" NewOnly="False" /> 
    <Report Status="Active" NewOnly="False" /> 
    </SaveMessages> 
    <ProjectFile Compress="True" DefaultTargetCheck="True" DefaultRuleCheck="True" SaveByRuleGroup="" Deterministic="True" /> 
    <EnableMultithreadedLoad>True</EnableMultithreadedLoad> 
    <EnableMultithreadedAnalysis>True</EnableMultithreadedAnalysis> 
    <SourceLookup>True</SourceLookup> 
    <AnalysisExceptionsThreshold>10</AnalysisExceptionsThreshold> 
    <RuleExceptionsThreshold>1</RuleExceptionsThreshold> 
    <Spelling Locale="en-GB" /> 
    <OverrideRuleVisibilities>False</OverrideRuleVisibilities> 
    <CustomDictionaries SearchFxCopDir="True" SearchUserProfile="True" SearchProjectDir="True" /> 
    <SearchGlobalAssemblyCache>False</SearchGlobalAssemblyCache> 
    <DeadlockDetectionTimeout>120</DeadlockDetectionTimeout> 
    <IgnoreGeneratedCode>False</IgnoreGeneratedCode> 
</ProjectOptions> 
<Targets> 
    <Target Name="$(ProjectDir)/../../solution/PrecompiledWeb/application/bin/App_Code.dll" Analyze="True" AnalyzeAllChildren="True" /> 
</Targets> 
<Rules> 
    <RuleFiles> 
    <RuleFile Name="$(FxCopDir)\Rules\DesignRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    <RuleFile Name="$(FxCopDir)\Rules\GlobalizationRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    <RuleFile Name="$(FxCopDir)\Rules\InteroperabilityRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    <RuleFile Name="$(FxCopDir)\Rules\MobilityRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    <RuleFile Name="$(FxCopDir)\Rules\NamingRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    <RuleFile Name="$(FxCopDir)\Rules\PerformanceRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    <RuleFile Name="$(FxCopDir)\Rules\PortabilityRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    <RuleFile Name="$(FxCopDir)\Rules\SecurityRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    <RuleFile Name="$(FxCopDir)\Rules\UsageRules.dll" Enabled="True" AllRulesEnabled="True" /> 
    </RuleFiles> 
    <Groups /> 
    <Settings /> 
</Rules> 
<FxCopReport Version="1.36" /> 
</FxCopProject> 
+0

我一直在寻找更深入的规则过滤。例如,Microsoft.Design规则集中的规则CA1014“使用CLSCompliantAttribute标记程序集”可以忽略。实际上,我正在寻找一组可以忽略的规则列表,这些列表可能会导致开发社区通常使用的规则列表被默认的每个FxCop规则集所忽略。 – koder

0

不,没有这样的野兽。即使有,你如何确定创建名单的人确实适合你的情况?

只有200左右的规则。为什么不坐下一两个小时来弄清楚哪些是你认为重要的?你甚至可以采取快捷方式,只看当前给你的违规行为。这可能会使筛选工作降至不到1/2小时。

相关问题