New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more type signatures. #8956
Conversation
b1da3ed
to
298ebfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's talk either here or https://github.com/Homebrew/brew/pull/8952/files#r508398399 about the RBI vs. Ruby inline sig
usage.
04ce7f6
to
f110b6c
Compare
Pretty much the only thing that needs to be in |
My understanding on the conversation in #8781 was that we were still going to keep definitions in RBI files until we were further along with coverage here. I appreciate I approved that PR without that being the case but I think I misunderstood what was going on there given the size of the PR and I apologise for my mistake there.
Having |
06e138f
to
b94eb09
Compare
I specifically added |
There's no way of knowing whether a method is “new”. At best we can do this on a per-file basis by enforcing |
Yes, I appreciate that (and thanks for it). I'm concerned about the source code readability overhead for adding these type signatures inline. I think it harms readability to have them inline.
Yes, that's what I'm saying we should continue to do: exclude those files but have the definitions be in |
I think it very much improves readability to have the signature right next to the function. You can very easily see how a given function is supposed to be used. |
The whole point of #8781 was to enable writing annotations inline because maintaining the exact same class hierarchy and method definitions in two different sets of files is a giant pain. |
I disagree. It requires understanding Sorbet type definitions to read our code which increases the barrier to entry for people who haven't worked with typed languages or type-annotations in languages. It's also far from commonplace in large Ruby projects at this point. We have a minority of maintainers who have worked with, added or changed these type annotations.
And I voiced my objections there to writing annotations inline. I maintain those objections and should not have ✅ that PR. Given it was a +1714,-59 line change with many iterations: I'll forgive myself from the mistake of not fully understanding where it was at at the time it was merged. It may be a pain but it's also a pain to have to scan through this information when reading files. |
In case it's worth elaborating here on what I see as the underlying problem: we had a GSoC project to use Sorbet in Homebrew without a broader discussion of the pros and cons and whether it's desirable to (effectively) make Homebrew/brew use type annotations globally and transform our untyped codebase into a typed one. From https://docs.brew.sh/Homebrew-Governance:
It feels like these two aren't being adhered to with how this Sorbet rollout has been happening (and may be in slight conflict). I think this is something for @Homebrew/plc to discuss. |
Can you elaborate on this? How are they not being adhered to? |
From my perspective it does not feel like the TSC has been involved in this "major change(s) to the Homebrew software" and it does not feel on this or other PRs that I am "manag(ing) all day-to-day technical decisions related to the operation of Homebrew". |
Have opened #8991 to be able to discuss the underlying issues directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocked on #8991 voting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TSC have voted: #8991 (comment)
- Homebrew should add type information for all Homebrew/brew Ruby files
- Homebrew should not enable type checking at brew runtime
- Homebrew/brew should not use separate RBI files for storing type information
- Missing types on new files should not cause a CI failure which requires them to be added
I'm not sure from this PR which of these are/are not currently the case but ✅ with the assumption that once/if they are all the case: this can be merged.
Relatedly (but not needing to block this PR) from #9099:
- Improve the documentation in https://docs.brew.sh/Typechecking
- Improve tooling/CI output (e.g. brew typecheck) to reference documentation (and vice-versa)
- Consider/investigate improving naming here with some of our own aliases to be Type::Signature
It would be good to prioritise this work (or debate it) before moving forward with many more types.
Thanks @reitermarkus!
1b09d2e
to
cd90acc
Compare
brew style
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?