4

I'm currently getting the following messages from the VS2012 code analysis tool:

CA1709 Identifiers should be cased correctly In member 'Action.ExecuteAction(string, string)', correct the casing of 'ID' in parameter name 'merchantID' by changing it to 'Id'. 'Id' is an abbreviation and therefore is not subject to acronym casing guidelines.

I have this defined in my GlobalSuppressions.cs file:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
    "Microsoft.Naming", 
    "CA1709:IdentifiersShouldBeCasedCorrectly", 
    MessageId = "ID", 
    Scope = "Global")]

How can I define a rule that says "ignore this specific spelling (I want ID, not Id) in all files"?

EDIT: Mike's solution worked, this is what I ended up with:

<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
    <Acronyms>
        <CasingExceptions>
            <Acronym>ID</Acronym>
        </CasingExceptions>
    </Acronyms>
</Dictionary>
D Stanley
  • 149,601
  • 11
  • 178
  • 240
Codeman
  • 12,157
  • 10
  • 53
  • 91

1 Answers1

3

What you're going to want to do, I believe, is add an acronym for ID to a custom dictionary and then you'll be able to drop the global suppression. Follow these instructions to do so.

But, in short, here is a snippet pulled from that document that should be what yours looks like a bit ...

<Dictionary>
      <Acronyms>
         <CasingExceptions>
            <Acronym>ID</Acronym>   <!-- Identifier -->
            ...
         </CasingExceptions>
         ...
      </Acronyms>
      ...
</Dictionary>

... however, if it's not an acronym it's one of those categories.

Mike Perrenoud
  • 66,820
  • 29
  • 157
  • 232
  • This worked great! As a general rule, there should be a summary of the steps given in a link for an answer, but I'll mark this as correct. – Codeman Oct 05 '12 at 18:39
  • @Pheonixblade9, I'm glad I could be of assistance, and I honestly felt that because it was a Microsoft link I wouldn't put the steps in for preservation but rather give you an idea of what piece of the document you would want to be in ... I could have placed the steps here though. Thanks! – Mike Perrenoud Oct 05 '12 at 18:41