2012-05-10 31 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小時。

相關問題