Shared naming conventions allow teams to collaborate efficiently. This rule checks that all enum names match a provided regular
expression.
The default configuration is the one recommended by Microsoft:
With the default regular expression for non-flags enums: ^([A-Z]{1,3}[a-z0-9]+)*([A-Z]{2})?$
public enum foo // Noncompliant
{
FooValue = 0
}
With the default regular expression for flags enums: ^([A-Z]{1,3}[a-z0-9]+)*([A-Z]{2})?s$
[Flags]
public enum Option // Noncompliant
{
None = 0,
Option1 = 1,
Option2 = 2
}
public enum Foo
{
FooValue = 0
}
[Flags]
public enum Options
{
None = 0,
Option1 = 1,
Option2 = 2
}