sorbet: Bump more tests to typed: true#22542
Merged
Merged
Conversation
cb184f4 to
14e04fc
Compare
c75208e to
ae404f6
Compare
f01b0fe to
f1f6e9f
Compare
b8eed3e to
c8763e0
Compare
Code Coverage OverviewLanguages: Ruby Ruby / code-coverage/simplecovThe overall coverage in the branch is 75%. The coverage in the branch is 78%. Show a code coverage summary of the most impacted files.
Updated |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR increases Sorbet coverage in the Homebrew test suite by bumping additional specs to # typed: true (and one to # typed: strict) and making the minimal adjustments needed for those files to typecheck.
Changes:
- Bump multiple RSpec files from
typed: falsetotyped: true/typed: strict. - Add Sorbet-friendly “dummy”
letvalues andT.bindannotations for DSL blocks used in specs. - Make small Ruby adjustments to satisfy typing (e.g., avoiding
return raise, coercing paths to strings).
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/test/utils/user_spec.rb | Replace multi-line Sorbet note with a concise dummy let comment. |
| Library/Homebrew/test/utils/string_inreplace_extension_spec.rb | Add/clarify dummy let(:string) needed for Sorbet. |
| Library/Homebrew/test/utils/ruby_check_version_script_spec.rb | Add/clarify dummy let(:required_ruby_version) needed for Sorbet. |
| Library/Homebrew/test/system_command_result_spec.rb | Bump to typed: true and add dummy stdout to satisfy typing. |
| Library/Homebrew/test/services/formula_wrapper_spec.rb | Bump to typed: true and adjust spec code for Sorbet (service file path handling). |
| Library/Homebrew/test/dev-cmd/lgtm_spec.rb | Bump to typed: true and adjust __dir__ usage for Sorbet. |
| Library/Homebrew/test/cmd/version-install_spec.rb | Bump to typed: true and simplify exception raising. |
| Library/Homebrew/test/cmd/update_spec.rb | Bump to typed: true and adjust __dir__ usage for Sorbet. |
| Library/Homebrew/test/cmd/log_spec.rb | Bump to typed: strict and ensure system receives string paths. |
| Library/Homebrew/test/cmd/bundle/remove_subcommand_spec.rb | Bump to typed: true, add Sorbet-focused dummy lets, and bind DSL self type in formula stub. |
| Library/Homebrew/test/cmd/bundle/list_subcommand_spec.rb | Bump to typed: true and refactor option-combination coverage to be Sorbet-friendly. |
| Library/Homebrew/test/cleaner_spec.rb | Bump to typed: true and add T.bind for formula DSL blocks. |
| Library/Homebrew/test/cask/dsl/container_spec.rb | Bump to typed: true and add dummy params for Sorbet. |
| Library/Homebrew/test/cask/dsl_spec.rb | Add/clarify dummy languages for Sorbet. |
| Library/Homebrew/test/cask/depends_on_spec.rb | Bump to typed: true and add a Sorbet-required top-level cask let. |
| Library/Homebrew/test/cask/artifact/zshcompletion_spec.rb | Bump to typed: true and add dummy cask_token for Sorbet. |
| Library/Homebrew/test/cask/artifact/manpage_spec.rb | Bump to typed: true and add dummy cask_token for Sorbet. |
| Library/Homebrew/test/cask/artifact/fishlcompletion_spec.rb | Bump to typed: true and add dummy cask_token for Sorbet. |
| Library/Homebrew/test/cask/artifact/bashcompletion_spec.rb | Bump to typed: true and add dummy cask_token for Sorbet. |
| Library/Homebrew/test/bundle/bundle_spec.rb | Bump to typed: true and add dummy brewfile_content for Sorbet. |
| Library/Homebrew/test/build_environment_spec.rb | Bump to typed: true and add a T.bind for DSL use in an anonymous class. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
Library/Homebrew/test/cask/depends_on_spec.rb:16
- There are now two identical
let(:cask)definitions (outer one added for Sorbet, and another insidedescribe "depends_on cask"). The inner one is redundant and can be removed to reduce duplication and avoid confusion about whichcaskis in scope.
let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-cask")) } # Dummy value required for Sorbet.
describe "depends_on cask" do
let(:dependency) { Cask::CaskLoader.load(cask.depends_on.cask.first) }
let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-cask")) }
- Files reviewed: 21/21 changed files
- Comments generated: 1
MikeMcQuaid
reviewed
Jun 5, 2026
Member
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks! Same pattern in a few places (and perhaps in previous PRs too)
- `File.delete` expects a `String` or `Pathname`, but the test was passing it a `File`.
- `__dir__` is always a String, but Sorbet can't tell that.
- The `env` test is testing the BuildEnvironment env.
c8763e0 to
3bce32d
Compare
- Follow up to 8862004. - Also slim down the comments added in that commit, as it was too verbose to put everywhere else.
- Replace per-combination dynamic context generation with a single runtime-iterating example so RSpec expectations typecheck cleanly under Sorbet. - Generated with AI, specifically GPT 5.3 Codex (Medium).
- Pass `shallow_tap.path` as a String to the `system` method.
3bce32d to
a27e37e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brew lgtm(style, typechecking and tests) with your changes locally?typed: true#22532, but that PR got closed (for good reason), so re-opening on top of the better branch.