Search code examples
c#stylecopnaming-conventions

StyleCop+ Advanced Naming Rules, variable naming


How can I configure a StyleCop+ naming rule, in such a way that my variable name like controlUI, controlHVACTest, etc. gets validated successfully?

For now, since it is not in sampleName format, the StyleCop+ complains about the naming convention.

Also, what is the best way to add custom naming validation rules?


Solution

  • The most convinient way to allow names like controlUI and controlHVACTest is to add UI and HVAC into "Abbreviations" section.

    Regarding your question about "changing AaBb to A*B*" - I'm not sure that I understand what your mean. StyleCop+ naming rules are very flexible indeed, but if you setup your naming template to $(A)$(*)$(A)$(*) (which seems similar to what you were talking about) - it will force all names to have at least two capital letters (that do not follow each other).

    If you specify your situation a little bit more, I could try to help you setup your naming templates, if possible.