protolint
protolint copied to clipboard
ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH failing even with `allow_alias = true`
ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH does not recognise that an enum already contains an alias for the "ZERO VALUE" that has the required suffix.
It shouldn't fail in that case
enum ProtoSentiment {
option allow_alias = true;
PROTO_SENTIMENT_UNSPECIFIED = 0;
PROTO_SENTIMENT_NEUTRAL = 0;
PROTO_SENTIMENT_NEGATIVE = 11;
PROTO_SENTIMENT_POSITIVE = 1;
}
When linting the snippet, I got EnumField name "PROTO_SENTIMENT_NEUTRAL" with zero value should have the suffix "UNSPECIFIED". This is valid.
Verifies that the zero value enum should have the suffix (e.g. "UNSPECIFIED", "INVALID"). https://github.com/yoheimuta/protolint?tab=readme-ov-file#rules
The following enum definition is no problem.
enum ProtoSentiment {
option allow_alias = true;
PROTO_SENTIMENT_UNSPECIFIED = 0;
PROTO_SENTIMENT_NEUTRAL = 1;
PROTO_SENTIMENT_NEGATIVE = 2;
PROTO_SENTIMENT_POSITIVE = 3;
}