enum-no-allow-alias
What it does
Section titled “What it does”Reports option allow_alias = true; in an enum.
Why it matters
Section titled “Why it matters”Aliases give two names to one number. A value read from the wire becomes one of the names, which one depends on the generator, so the name in the code is not stable, and JSON output shows one of them.
To fix, give each value its own number, and remove the option.
Example
Section titled “Example”...}
enum Aliased { option allow_alias = true; ALIASED_UNSPECIFIED = 0;...}Configuration
Section titled “Configuration”protobuf: lint: rules: enum-no-allow-alias: warn # off (default), warn, errorEnabled by the presets: protobuf/buf-standard.
Suppress one line with sudsy-disable-next-line enum-no-allow-alias 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_NO_ALLOW_ALIAS |
full |