https://pantsbuild.org/ logo
#general
Title
# general
h

hundreds-father-404

03/11/2022, 5:01 PM
An exciting new feature just merged for Pants 2.11 thanks to @narrow-vegetable-37489: Protobuf linting with Buf. Thank you ๐Ÿ™Œ https://github.com/pantsbuild/pants/pull/14540
๐ŸŽ‰ 4
๐Ÿ”ฅ 5
๐Ÿฅ 1
๐Ÿ™Œ 4
w

wide-midnight-78598

03/11/2022, 5:04 PM
Sweet, I've been using Buf for a while now. I like lots of it. Would be nice to not have to keep updating it in Brew though ๐Ÿ™‚
โค๏ธ 1
h

hundreds-father-404

03/11/2022, 5:06 PM
And make sure CI is aligned with what you use on your desktop. That's what motivated our Shell support, that Shellcheck in CI had lint failures people didn't get via brew install
๐Ÿ™Œ 1
h

high-yak-85899

03/11/2022, 5:26 PM
Nice! We just started using this internally separate from Pants.
๐Ÿ’ฏ 1
h

hundreds-father-404

03/11/2022, 5:28 PM
Neat! Btw if there are ever (open source) linters like that that you're using but Pants doesn't yet support, please do open up a GitHub ticket. Even if you don't have time to implement it. That's how Buf support started https://github.com/pantsbuild/pants/issues/13189
โž• 1
n

narrow-vegetable-37489

03/11/2022, 5:30 PM
๐Ÿ––
f

fresh-cat-90827

03/11/2022, 5:36 PM
this is awesome. I was looking briefly into linting of protobufs a couple of years ago. One thing that I donโ€™t think any of the linters supported then (and I didnโ€™t bother writing own plugins/rules) was checking for using Python reserved keywords as fields, see https://developers.google.com/protocol-buffers/docs/reference/python-generated#keyword-conflicts:
Copy code
message Baz {
  optional int32 from = 1
  repeated int32 in = 2;
}
Copy code
baz = Baz()
setattr(baz, "from", 99)
assert getattr(baz, "from") == 99
getattr(baz, "in").append(42)
assert getattr(baz, "in") == [42]
Copy code
# WRONG!
<http://baz.in|baz.in>  # SyntaxError: invalid syntax
baz.from  # SyntaxError: invalid syntax
does any of the linters support this?
h

high-yak-85899

03/11/2022, 5:38 PM
Buf does not analyze generated code. It's about detecting styling and wire format breaking changes with just .proto definitions as far as I understand it.
Oh I see what you mean. I was confused by the wording with the example usage.
b

busy-vase-39202

03/11/2022, 6:02 PM
Really cool! Thank you @narrow-vegetable-37489!
๐Ÿ™Œ 1
h

hundreds-father-404

03/25/2022, 8:17 PM
Buf integration gets even better in 2.11! @narrow-vegetable-37489 strikes again by adding
buf format
support to
fmt
goal to autoformat Proto files! (edit: buf only released this feature yesterday ๐Ÿ˜ฎ)
๐Ÿ™Œ 5
๐Ÿ‘ 1
๐Ÿ™ 3
h

happy-kitchen-89482

03/25/2022, 9:17 PM
Love to see it!
b

brash-baker-91190

03/25/2022, 9:33 PM
Wow, cool...
buf
released that feature yesterday
โ— 3
๐Ÿ˜… 1
b

busy-vase-39202

03/26/2022, 12:30 AM
We're so fortunate to have you, @narrow-vegetable-37489. Thanks for all the cool work you've been doing.
๐Ÿ™ 1
๐ŸŽ‰ 2