-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
sorbet: Convert some hidden-definitions
into RBI files
#14651
sorbet: Convert some hidden-definitions
into RBI files
#14651
Conversation
- Start decreasing the amount of stuff in the deprecated `srb rbi hidden-definitions` file. - Generated with a script I wrote, nothing fancy like Tapioca. - As with every time we add a new `Homebrew::CLI::Args` method, when we add a new colour or something here, we'll have to edit this RBI file when we get a Sorbet error.
- Start decreasing the amount of stuff in the deprecated `srb rbi hidden-definitions` file. - Generated with a script I wrote, nothing fancy like Tapioca. - As with every time we add a new `Homebrew::CLI::Args` method, when we add a new envvar or something here, we'll have to edit this RBI file when we get a Sorbet error.
Review period will end on 2023-02-17 at 01:06:39 UTC. |
Neat! One suggestion, if we're going to start building out large methods_before = Homebrew::EnvConfig.methods
require_relative `Library/Homebrew/env_config.rbi`
methods_after = Homebrew::EnvConfig.methods
expect(methods_after - methods_before).to be_empty wdyt? |
tbh we should probably just auto gen the rbi files. I can have a look given I did the one for |
module Homebrew::EnvConfig | ||
sig { returns(String) } | ||
def self.additional_google_analytics_id; end |
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.
Agreed with @Bo98: it'd be really nice to autogenerate these.
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.
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.
Now that 4.0.0 is out I can have a look at this.
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.
Will have something to show by Monday. I would point to the existing sorbet/parlour/attr.rb, but parser
code isn't always the easiest to follow so I'm looking to see if I can write that as a runtime generator rather than a static generator. Hardly anything we use supports Ruby 2.6 anymore (last Rubocop update is in about 6 weeks) so will need to see what is and isn't available for us on the versions we have.
Can we merge this as-is (since it's identical to any automatic generation) and work on the autogeneration separately? I recognise the manual process is non-ideal, but it was vaguely fun last night and whatever we write next can be done by the Sorbet action or whatever, and replace my fingers. |
Will this still be automatically updated when we e.g. change |
Oh. No. 😁 But |
Sorry @issyl0, this feels like a step back if it's adding more manual work that was previously done by CI 😭 |
I'd argue that it's still moving us forward because |
Review period ended. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?srb rbi hidden-definitions
file by adding RBI files for dynamically generated methods.srb rbi hidden-definitions
command is deprecated and we've tried removing it before, but the outcome was that we needed to write more RBI files and it wasn't a massive priority. Tonight I had (a little) desire to start this, with the help of a hacky script.