Skip to content

enum-value-prefix

Protobufstyleno fixdefault: offprotobuf/buf-standard

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

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.

Reported
...
enum HTTPCode {
HTTP_CODE_UNSPECIFIED = 0;
OTHER_PREFIX = 1;
}
enum Aliased {
...
protobuf:
lint:
rules:
enum-value-prefix: warn # off (default), warn, error

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

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
buf ENUM_VALUE_PREFIX full