enum-value-prefix
What it does
Section titled “What it does”Reports an enum value that does not start with the name of the enum in UPPER_SNAKE_CASE and an underscore (COLOR_RED in Color).
Why it matters
Section titled “Why it matters”Enum values are scoped to the enclosing message or file, not to the enum, as in C++. Two enums in one scope with a value RED collide, and the prefix prevents it.
To fix, add the prefix to the value.
Example
Section titled “Example”...
enum HTTPCode { HTTP_CODE_UNSPECIFIED = 0; OTHER_PREFIX = 1;}
enum Aliased {...Configuration
Section titled “Configuration”protobuf: lint: rules: enum-value-prefix: warn # off (default), warn, errorEnabled by the presets: protobuf/buf-standard.
Suppress one line with sudsy-disable-next-line enum-value-prefix in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| buf | ENUM_VALUE_PREFIX |
full |