Skip to content

sorbet: Bump more tests to typed: true#22542

Merged
issyl0 merged 8 commits into
mainfrom
sorbet-yet-more-tests
Jun 5, 2026
Merged

sorbet: Bump more tests to typed: true#22542
issyl0 merged 8 commits into
mainfrom
sorbet-yet-more-tests

Conversation

@issyl0
Copy link
Copy Markdown
Member

@issyl0 issyl0 commented Jun 4, 2026


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR.

@issyl0 issyl0 force-pushed the less-duplication-in-sorbet-rbis branch from cb184f4 to 14e04fc Compare June 4, 2026 22:41
@issyl0 issyl0 force-pushed the sorbet-yet-more-tests branch from c75208e to ae404f6 Compare June 4, 2026 23:33
@issyl0 issyl0 force-pushed the less-duplication-in-sorbet-rbis branch from f01b0fe to f1f6e9f Compare June 4, 2026 23:35
@issyl0 issyl0 force-pushed the sorbet-yet-more-tests branch 2 times, most recently from b8eed3e to c8763e0 Compare June 4, 2026 23:37
@github-code-quality
Copy link
Copy Markdown

github-code-quality Bot commented Jun 4, 2026

Code Coverage Overview

Languages: Ruby

Ruby / code-coverage/simplecov

The overall coverage in the branch is 75%. The coverage in the branch is 78%.

Show a code coverage summary of the most impacted files.
File c6a08de a27e37e +/-
cask/info.rb 96% 0% -96%
cask/installer.rb 91% 28% -63%
cask/artifact/a...ct_uninstall.rb 89% 32% -57%
cask/audit.rb 63% 25% -38%
cask/cask_loader.rb 96% 65% -31%
bundle/extensions/flatpak.rb 37% 94% +57%
extend/os/linux/diagnostic.rb 0% 67% +67%
os/linux/elf.rb 0% 86% +86%
extend/os/linux/sandbox.rb 0% 95% +95%
extend/os/linux...ystem_config.rb 0% 99% +99%

Updated June 05, 2026 21:01 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Base automatically changed from less-duplication-in-sorbet-rbis to main June 5, 2026 13:14
@issyl0 issyl0 marked this pull request as ready for review June 5, 2026 13:26
Copilot AI review requested due to automatic review settings June 5, 2026 13:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: false to typed: true / typed: strict.
  • Add Sorbet-friendly “dummy” let values and T.bind annotations 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 inside describe "depends_on cask"). The inner one is redundant and can be removed to reduce duplication and avoid confusion about which cask is 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

Comment thread Library/Homebrew/test/services/formula_wrapper_spec.rb
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Same pattern in a few places (and perhaps in previous PRs too)

Comment thread Library/Homebrew/test/cask/artifact/fishlcompletion_spec.rb Outdated
issyl0 added 3 commits June 5, 2026 20:57
- `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.
@issyl0 issyl0 force-pushed the sorbet-yet-more-tests branch from c8763e0 to 3bce32d Compare June 5, 2026 19:58
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks!

issyl0 added 5 commits June 5, 2026 21:42
- 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.
@issyl0 issyl0 force-pushed the sorbet-yet-more-tests branch from 3bce32d to a27e37e Compare June 5, 2026 20:42
@issyl0 issyl0 enabled auto-merge June 5, 2026 20:44
@issyl0 issyl0 added this pull request to the merge queue Jun 5, 2026
Merged via the queue into main with commit 7371776 Jun 5, 2026
38 checks passed
@issyl0 issyl0 deleted the sorbet-yet-more-tests branch June 5, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants