Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code Analysis - CA1704: Correct the spelling of 'Ps'

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?

like image 947
openshac Avatar asked Jan 26 '11 10:01

openshac


2 Answers

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.

like image 57
Nicole Calinoiu Avatar answered Oct 12 '22 11:10

Nicole Calinoiu


"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 -->
like image 20
Willem van Rumpt Avatar answered Oct 12 '22 13:10

Willem van Rumpt