FxCop 使用Data Flow Rules

简介: FxCop的UI并未提供Phoenix engine的支持,也就是以下这些验证规则通过FxCop的 UI没有办法验证,但是可以通过FxCopCmd来验证 CA1062 Validate Arguments of Public Methods CA1303 Do Not Pass Literals...

FxCop的UI并未提供Phoenix engine的支持,也就是以下这些验证规则通过FxCop的 UI没有办法验证,但是可以通过FxCopCmd来验证

CA1062 Validate Arguments of Public Methods

CA1303 Do Not Pass Literals as Localized Parameters

CA2000 Dispose Objects Before Losing Scope

CA2100 Review SQL Queries For Security Vulnerabilities

CA2202 Do Not Dispose Objects Multiple Times

CA2204 Literals Should Be Spelled Correctly

CA2215 Dispose Methods Should Call Base Class Dispose

CA2241 Provide Correct Arguments to Formatting Methods

 

可以通过对.FxCop文件添加规则来实现

   1: <FxCopProject Version="10.0" Name="My FxCop Project">
   2:  <Rules>
   3:    <RuleFiles>
   4:    <RuleFile Name="$(ProjectDir)/../Rules/DataflowRules.dll" Enabled="True" AllRulesEnabled="True" AllRulesBreakBuild="True" />
   5:    </RuleFiles>
   6:  </Rules>
   7:  </FxCopProject>

 

DataflowRules.dll文件可以在%Program Files%\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\Rules中找到,XML的路径可以自己视情况添加

 

Reference:

http://blogs.msdn.com/b/codeanalysis/archive/2010/04/14/data-flow-analysis-rules-in-visual-studio-2010.aspx

http://msdn.microsoft.com/zh-cn/library/bb429449(v=vs.80).aspx

http://msdn.microsoft.com/en-us/library/dd264939

目录
相关文章
|
6月前
webpack 使用打包报错 ERROR in node_modules\@types\node\ts4.8\assert.d.ts
webpack 使用打包报错 ERROR in node_modules\@types\node\ts4.8\assert.d.ts
429 0
|
4月前
|
JavaScript 索引
Component name “index“ should always be multi-word vue/multi-word-component-names
Component name “index“ should always be multi-word vue/multi-word-component-names
|
5月前
|
存储 设计模式 缓存
《500 Lines or Less》(4)Contingent: A Fully Dynamic Build System(构建系统)
《500 Lines or Less》(4)Contingent: A Fully Dynamic Build System(构建系统)
Warning: To load an ES module, set “type“: “module“ in the package.json or use the .mjs extension.
Warning: To load an ES module, set “type“: “module“ in the package.json or use the .mjs extension.
|
4月前
|
JavaScript
Component name “header“ should always be multi-word
Component name “header“ should always be multi-word
|
6月前
Angular启动/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference‘ directive syntax.
Angular启动/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference‘ directive syntax.
76 2
|
6月前
|
JavaScript
【Vue Error】 error Component name “product“ should always be multi-word vue/multi-word-compone……
【Vue Error】 error Component name “product“ should always be multi-word vue/multi-word-compone……
|
11月前
(node)Warning: Accessing non-existent property ‘xxx‘ of module exports inside circular depen
(node)Warning: Accessing non-existent property ‘xxx‘ of module exports inside circular depen
打包报错Error: ‘default‘ is not exported by node_modules/qs/lib/index.js
打包报错Error: ‘default‘ is not exported by node_modules/qs/lib/index.js
269 0
error: R_LARCH_SOP_PUSH_PCREL against `x264_log_default‘:PLT shouldn‘t be with r_addend.
error: R_LARCH_SOP_PUSH_PCREL against `x264_log_default‘:PLT shouldn‘t be with r_addend.
203 0