[Feature request] Check comment spacing
Is your feature request related to a problem? Please describe.
In our projects, some comments didn't follow the style guides, such as commented code:
//t.Log(err)
//t.Log(targets)
or the normal comments:
ClientIp string `protobuf:"bytes,11,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"` //client IP
ClientIpv6 string `protobuf:"bytes,12,opt,name=client_ipv6,json=clientIpv6,proto3" json:"client_ipv6,omitempty"` // client IPv6
There should be a space between the leading // and the comment text.
Describe the solution you'd like Add a rule to check commit spacing.
But for line comments, special comments such as compile directives:
//go:noinline
//go:generate go mod tidy
//go:generate mockgen
//revive:disable
should be allowed. We can use a whitelist to allow these forms. The default whitelist can be
"\w+:\w+"
, which can match most special comments.
I'd like that rule! Do you want to implement it and we can merge?
I'd like to implement this feature.
Hi, May I work on this issue?
Thanks, for assigning this issue to me. Going through the code base. Will get back to you, if I have any issues. Will raise a draft PR, half way through and request a review once done.
Are there any other special comments or directives that I should look out for other than those mentioned in the issue? Is there a list that I can refer to ?? I can add a logic to match //go:* and //revive:* expression. Or would you rather like me to have a hard coded list?
Thanks @chavacava for the merge. If there are any other issues that I can work on, please let me know. I think this issue can be closed.
Thanks @qascade!