Add and vendor rubocop-sorbet and sorbet-runtime-stub.#8781
Add and vendor rubocop-sorbet and sorbet-runtime-stub.#8781reitermarkus merged 11 commits intoHomebrew:masterfrom
rubocop-sorbet and sorbet-runtime-stub.#8781Conversation
6b22d95 to
05da088
Compare
issyl0
left a comment
There was a problem hiding this comment.
Wow, big PR. Thanks for all this effort, Markus - I didn't expect you to go quite this far yet! 😲
A few comments on the general things you've done here - hopefully I'll have time to test this out and review the results of these changes later or tomorrow!
I remember in the original GSoC PR, Mike requested that Sorbet stuff be kept out of the main files and done separately, which is why we went for "sorbet/files.yaml" with all the files and only adding RBI files, not actually adding signatures to the code using sorbet-runtime. But he didn't specify "until x time". As a result, I suggest leaving this open until tomorrow and asking him.
These days, now GSoC is over and it's a thing we're definitely doing, in my opinion we're only going to increase adoption if we make Sorbet's typing mechanisms visible.
Adding rubocop-sorbet was a thing on Vidushee's original project plan for towards the end of GSoC, but it was eclipsed by other priorities because the project was so expansive. Thanks for doing it!
Again, those were some comments on the approach. If there are any clarifications you need/want, then shout!
I don't think it's feasible to keep maintaining type information in separate files. It's already hard enough adding this information, but maintaining two sets of files and keeping them in sync is just way too tedious for this to gain adoption in the code base. |
|
@reitermarkus I 100% agree. |
491cdd7 to
77116c8
Compare
I'm 👍🏻 on vendoring this
Given reasoning below: I'm 👎🏻 on vendoring this for now
I still think we're not there yet and that typing information in-file makes the Ruby code significantly harder to read and follow to non-Sorbetists (which we're far from having all maintainers being, let alone contributors). The stage I'd see a rollout be:
I don't think "two sets of files" is more harmful to wider adoption than "understanding Sorbet is non-trivial" and I really don't want to start making that a requirement for casual contributors (yet, at least). |
Now Markus has done the majority of the annoying things in the base output (the current
It already is run on CI, but when we're starting from 0 errors we can remove the |
Agreed, great work @reitermarkus 👏🏻
I'm not sure yet 😭 I guess I see that being variable depending on what 👇🏻 looks like?
Yes, sorry, this is what I mean 🎉. Presumably this will also start us down the route of "if new contributors add new functions: they need to add type information" too? I think that's a good starting point. |
And keeping this information in separate files only lengthens the time for them to become familiar with it because no one will just casually look at the |
77116c8 to
ab0250d
Compare
This begs the quest: does a casual Homebrew contributor or all Homebrew/brew maintainers need to become familiar with it now? I would strongly argue: "no" or at least "not yet". |
Why not and when would “not yet” ever become “now“ with that mindset? |
It adds friction to contributing to Homebrew with essentially no end-user benefit. I'm yet to see a single user-reported issue that has or would have been fixed by Sorbet and enabling it at runtime will further slow down boot of all I think it's worth having as an investment in the future and moving in that direction gradually but: we're not there yet. Here's what I'd see as being the steps along the way:
|
How so? It is optional type information. If you are editing an existing file there's no requirement to do anything unless everything in it is already typed, in which case you can just follow the existing pattern.
Take any issue ever which was caused by a missing method. In any case, type-checking is not for fixing errors but to prevent them from being introduced in the first place.
And we won't be there for a lot longer if we make it more difficult than it needs to be. What do other @Homebrew/maintainers think here? |
|
I don't think it would be too much of a hassle for new contributors since I would assume the majority of them isn't fluent in ruby yet and sorbet won't be that much of a hurdle to copy-paste. What I am really curious about is the change in boot time for brew, since that's something we get complaints about already. |
You're arguing against an incremental rollout of new technology because it'll be slower. Yes, that's the point: it's also more cautious and allows us to see and deal with issues as we move forwards iteratively.
I disagree. It's one thing being unfamiliar with Ruby, it's another being unfamiliar with manual type declarations in language/frameworks which is the case for many developers now. |
I'm not arguing against an incremental rollout. Moving from |
|
I don’t mean to derail the conversation (so feel free to not reply to this, but it felt worth mentioning), but seeing as Ruby 3 will support type annotations and it may be released not too far into the future (this year?) is Sorbet something we’ll want to stick with or eventually replace with Ruby’s implementation? If the latter and there’s an implementation difference (which seems to be the case) between Ruby 3 and Sorbet, the slower we go now the fewer we’ll need to change later. |
|
From https://sorbet.org/blog/2020/07/30/ruby-3-rbs-sorbet:
|
d8db1a5 to
f99d078
Compare
With what I mentioned earlier:
You're jumping from 1. to 4. here and putting 2. at the end. I would like to see each of these as separate PRs, please (and 2. be split into many different PRs along the way). 4. will also require profiling/benchmarking to demonstrate it's not regressing the boot time. |
I'd argue it should be at the end. Would you also argue that we should have 100% test coverage and only then actually run the tests? Anyways, I have replace the vendored |
No.
Nice work! A few final requests before this is merged:
|
https://github.com/Homebrew/brew/pull/8781/files#diff-07a58dc567223bb118b941b96f9dba79R4-R7
Running |
Yeh, turning on after the first makes sense to me (combined with turning off |
0b8009d to
a23ef92
Compare
a23ef92 to
5660947
Compare
rubocop-sorbet and sorbet-runtime.rubocop-sorbet and sorbet-runtime-stub.
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Looking good! One final question then think we're good to go.
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Great work and thanks for persevering on this @reitermarkus!
|
Yay, it's great to see this shipped! |
brew stylewith your changes locally?brew testswith your changes locally?brew manlocally and committed any changes?This adds
rubocop-sorbetfor checking common type-checking issues andsorbet-runtimeso we can add the type-checking annotations inline in Ruby files.Also fixed the remaining errors, except for the one fixed in sorbet/sorbet#3438.