开发者

Rule CA1709 and two letter-words

开发者 https://www.devze.com 2023-02-06 10:17 出处:网络
I have a library with a lot of functions that use two letter-non english-words like this: FinDeDia EsPrimo

I have a library with a lot of functions that use two letter-non english-words like this:

  • FinDeDia
  • EsPrimo
  • EnPreparacion
  • ...

Anyway, I activated code analysys for the project, and I'm getting the CA1709 warning:

CA1709 : Microsoft.Naming : 
Corrij开发者_JAVA技巧a el uso de mayúsculas y minúsculas en 'De' en el nombre del miembro '...' cambiándolo a 'DE'.

I added a code analysis dictionary as stated here but it doesn't ignore the warnings. Here is the structure of the dictionary.

<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
  <Words>
    <Recognized>
      <Word>de</Word>
      <Word>el</Word>
      <Word>en</Word>
      <Word>es</Word>
      <Word>si</Word>
      ...
    </Recognized>
  </Words>
</Dictionary>

What else should i do for handling this warning Without supressing the message?.

thanks in advance


You need to add them as CasingExceptions aswell:

  <Acronyms>
    <CasingExceptions>
      <Acronym>De</Acronym>
      <Acronym>El</Acronym>
      <Acronym>En</Acronym>
      <Acronym>Es</Acronym>
      <Acronym>Si</Acronym>
    </CasingExceptions>
  </Acronyms>
</Dictionary>

EDIT: Just be aware of the fact that this is somewhat a misuse, since none of those words are acronyms. Maybe you'd rather want to disable those specific rules. Afterall, many of code analysis' rules are based on the assumption that the API is written in English.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号