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

目录
打赏
0
0
0
0
1
分享
相关文章
|
10月前
webpack 使用打包报错 ERROR in node_modules\@types\node\ts4.8\assert.d.ts
webpack 使用打包报错 ERROR in node_modules\@types\node\ts4.8\assert.d.ts
702 1
|
6月前
ts中interface和type的区别
ts中interface和type的区别
205 21
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.
|
10月前
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.
113 2
|
10月前
|
TS中 type和interface的区别
TS中 type和interface的区别
1293 0
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
【Default config not found for ApplicationConfig】的一种解决方案
【Default config not found for ApplicationConfig】的一种解决方案
870 0
ES6的Set详解
ES6的Set详解
99 0
ts-node加载node_modules中的源码
ts-node加载node_modules中的源码
391 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等