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

OneOf fields aren't linted #268

Open
alexhayes opened this issue Aug 3, 2022 · 1 comment
Open

OneOf fields aren't linted #268

alexhayes opened this issue Aug 3, 2022 · 1 comment
Labels
question Further information is requested

Comments

@alexhayes
Copy link

While writing a custom rule FIELD_NAMES_CAMEL_CASE I discovered that oneof fields are not linted by the rule FIELD_NAMES_LOWER_SNAKE_CASE or FIELDS_HAVE_COMMENT.

For example, if you have;

syntax = "proto3";

message Foo {
  oneof MyField {
    string eggs = 1;
    string sausage = 2;
  }
}

This will pass linting even with the FIELD_NAMES_LOWER_SNAKE_CASE and/or FIELDS_HAVE_COMMENT enabled - when I'd expect it to complain about the MyField not being lower snake case and/or containing a comment.

Am I correct in thinking this is how it should behave or is that not the intended behaviour? It looks as if that's how it should behave.

@yoheimuta
Copy link
Owner

@alexhayes Thank you for reaching out.

I discovered that oneof fields are not linted by the rule

Oneof fields are string eggs = 1; and string sausage = 2;, not oneof MyField { }.

Style Guide mentions oneof field, but not oneof (name).

Regardless of that, your suggestion might be appropriate as Language Guide uses underscore_separated_names for oneof name. And it makes sense that protolint needs to provide a way to complain about the MyField not containing a comment at least.
Meanwhile, I'm not sure oneof (not oneof fields) should be dealt with as fields.
What do you think?

@yoheimuta yoheimuta added the question Further information is requested label Aug 6, 2022
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