enum-zero-value-suffix
What it does
Section titled “What it does”Reports an enum value numbered 0 whose name does not end in _UNSPECIFIED.
Why it matters
Section titled “Why it matters”The zero value is what a field has when it is not set, so its name should say “nothing chosen”. A zero value named ACTIVE makes missing data look like a real choice.
To fix, name it <ENUM>_UNSPECIFIED.
Example
Section titled “Example”...}
enum NoSuffix { NO_SUFFIX_NONE = 0; NO_SUFFIX_ONE = 1;}
...enum Aliased {... ALIASED_UNSPECIFIED = 0; ALIASED_NONE = 0;}Configuration
Section titled “Configuration”protobuf: lint: rules: enum-zero-value-suffix: warn # off (default), warn, errorEnabled by the presets: protobuf/buf-standard.
Suppress one line with sudsy-disable-next-line enum-zero-value-suffix in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| buf | ENUM_ZERO_VALUE_SUFFIX |
partial | The suffix is not configurable. |