Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH failing even with allow_alias = true #377

Open
bjoernmayer opened this issue Apr 4, 2024 · 1 comment
Labels
question Further information is requested

Comments

@bjoernmayer
Copy link

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;
}
@yoheimuta
Copy link
Owner

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;
}

@yoheimuta yoheimuta added the question Further information is requested label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants