yoheimuta / protolint

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

trailing comments on fields supported? #292

Closed quintilation closed 1 year ago

quintilation commented 2 years ago

Hi,

We have a lot of comments like this:

message xyz { string a = 1; // first arg

  // next arg
   bool  b = 2;

}

But protolint is complaining the field a does not have a comment? Have I missed a trick or are only preceeding/prefix comments supported?

Thanks, -Steve

yoheimuta commented 2 years ago

@quintilation Thank you for telling me.

No. protolint's HAVE_COMMENT rules don't support trailing comments. And your question makes sense. I realize the support would be worth it, so I'm getting to it soon.

yoheimuta commented 2 years ago

@quintilation I've cut a release of v0.42.0. Can you give it a try?

quintilation commented 2 years ago

Thanks very much, this almost does what we would like... We have one case which fails in our proto files, rpc statments. These again have trailing comments and are not found by protolint

    rpc GetAll(GetRequest) returns(GetReply) {          // get the global address table
        option(requestreply.Nats).Subject = "get.addrs";
    }

produces
            [addrs/addrs.proto:44:2] RPC "GetAll" should have a comment
yoheimuta commented 1 year ago

Thank you for letting me know. I'm working on it.

yoheimuta commented 1 year ago

@quintilation I fixed it. Could you please install v0.42.1?

yoheimuta commented 1 year ago

I fixed it and some time passed, so I'm closing this issue.