Skip to content

enum-zero-value-suffix

Protobufstyleno fixdefault: offprotobuf/buf-standard

Reports an enum value numbered 0 whose name does not end in _UNSPECIFIED.

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.

Reported
...
}
enum NoSuffix {
NO_SUFFIX_NONE = 0;
NO_SUFFIX_ONE = 1;
}
...
enum Aliased {
...
ALIASED_UNSPECIFIED = 0;
ALIASED_NONE = 0;
}
protobuf:
lint:
rules:
enum-zero-value-suffix: warn # off (default), warn, error

Enabled 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.

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.