代码分析-CA1704:更正"P"的拼写 [英] Code Analysis - CA1704: Correct the spelling of 'Ps'

查看:89
本文介绍了代码分析-CA1704:更正"P"的拼写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2010中的代码分析中收到以下警告

I am getting the following warning from Code Analysis in VS2010

CA1704:Microsoft.Naming:正确 会员名中"Ps"的拼写 'MyClass.PsCalculatedAmount'或删除 它完全代表任何形式 匈牙利符号.

CA1704 : Microsoft.Naming : Correct the spelling of 'Ps' in member name 'MyClass.PsCalculatedAmount' or remove it entirely if it represents any sort of Hungarian notation.

现在在我的代码库中,"Ps"的意思是每股",并且使用率很高,所以我想允许它作为可接受的单词/缩写.

Now in my codebase 'Ps' means 'Per Share' and is used heavily, so I would like to allow it as an acceptable word/acronym.

我尝试将其添加到

<Words>
    <Recognized>
        <Word>ps</Word>
...
    <Recognized>
<Words>

也尝试过

<Acronyms>
    <CasingExceptions>
        <Acronym>Ps</Acronym>
    ...
    <CasingExceptions>
<Acronyms>

但我仍然收到警告.

我应该做些不同的事情吗?

Is there something I should be doing differently?

我注意到FXCop中存在一个与此相关的错误,该错误现已修复; http://social.msdn.microsoft.com/Forums/zh/vstscode/thread/54e8793c-e821-49b2-80db-ea1420acf1e6

I noticed that there had been a bug in FXCop regarding this which is now fixed; http://social.msdn.microsoft.com/Forums/en/vstscode/thread/54e8793c-e821-49b2-80db-ea1420acf1e6

我正在使用的Visual Studio版本中是否仍然存在此错误:V10.0.30319?

Is there a chance that this bug still exists in the version of Visual Studio i am using: V10.0.30319?

推荐答案

它被拒绝,因为它在Code Analysis安装文件夹(通常为%ProgramFiles%\ Microsoft Visual Studio 10.0 \)中的根"自定义词典中标记为无法识别的单词.小组工具\静态分析工具\ FxCop).您需要先将其从根词典无法识别的列表中删除,然后才能将其添加到项目专用词典中的已识别单词中.

It's being rejected because it's flagged as an unrecognized word in the "root" custom dictionary in Code Analysis installation folder (usually %ProgramFiles%\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop). You'll need to remove it from the root dictionary unrecognized list before adding it as a recognized word in a project-specific dictionary will take effect.

这篇关于代码分析-CA1704:更正"P"的拼写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆