代码分析 - CA1704:更正“Ps”的拼写

发布于 2024-10-14 05:05:18 字数 940 浏览 6 评论 0原文

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

CA1704:Microsoft.Naming:正确 会员姓名中“Ps”的拼写 'MyClass.PsCalculatedAmount' 或删除 如果它代表任何种类,则完全如此 匈牙利表示法。

现在,在我的代码库中,“Ps”的意思是“每股”,并且被大量使用,因此我希望允许它作为可接受的单词/首字母缩略词。

我尝试将其添加到我的 CustomDictionary.xml 下

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

并尝试过,

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

但我仍然收到警告。

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

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

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

I am getting the following warning from Code Analysis in VS2010

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.

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

I tried adding it to my CustomDictionary.xml under

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

and also tried

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

but I still get the warning.

Is there something I should be doing differently?

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

狼亦尘 2024-10-21 05:05:18

它被拒绝,因为它在代码分析安装文件夹(通常为 %ProgramFiles%\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\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.

梦在深巷 2024-10-21 05:05:18

“Ps”也是我字典中 部分的一部分(我从未更改过它)。除了将其添加到 部分之外,还要将其从 部分中删除。

<Dictionary>
  <Words>
    <Unrecognized>
<!--      <Word>ps</Word> -->
       ...more entries
    </Unrecognized>
    <Recognized>
-      <Word>ps</Word>
       ...more entries
    </Recognized>
    <!-- more stuff -->

"Ps" is also part of the <Unrecognized> section in my dictionary (and I never altered it). Apart from adding it to <Recognized> section, also remove it from the <Unrecognized> section.

<Dictionary>
  <Words>
    <Unrecognized>
<!--      <Word>ps</Word> -->
       ...more entries
    </Unrecognized>
    <Recognized>
-      <Word>ps</Word>
       ...more entries
    </Recognized>
    <!-- more stuff -->
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文