yoheimuta / protolint

A pluggable linter and fixer to enforce Protocol Buffer style and conventions.
MIT License
556 stars 51 forks source link

Rule to separate fields by newline #286

Open ricsiLT opened 1 year ago

ricsiLT commented 1 year ago

Hi, would it be easy to add a rule that would disallow this:

message Foo {
  // Example 1
  int32 field_one = 1;
  // Example 2
  int32 field_two = 2;
}

and force you to do this:

message Foo {
  // Example 1
  int32 field_one = 1;

  // Example 2
  int32 field_two = 2;
}
yoheimuta commented 1 year ago

@ricsiLT Yes. It's possible and not much difficult. You can use the position info of each message field to detect violations.