Skip to content

Update rubocop-sorbet to 0.13.0#23052

Merged
dduugg merged 2 commits into
mainfrom
update-rubocop-sorbet
Jul 11, 2026
Merged

Update rubocop-sorbet to 0.13.0#23052
dduugg merged 2 commits into
mainfrom
update-rubocop-sorbet

Conversation

@dduugg

@dduugg dduugg commented Jul 10, 2026

Copy link
Copy Markdown
Member

Updates rubocop-sorbet to 0.13.0. This has no upper bound on its rubocop dependency, so rubocop (1.88.1 -> 1.88.2) and rubocop-ast (1.49.1 -> 1.50.0) were also pulled in transitively; Gemfile.lock, the vendored standalone Bundler setup, and the Tapioca gem RBIs for rubocop/rubocop-ast are updated to match.

rubocop-sorbet 0.13.0 no longer flags Sorbet type_template/type_member constants under Style/MutableConstant, so the now-unnecessary rubocop:disable/rubocop:enable comment pairs (and their explanatory comments) are removed.

rubocop 1.88.2 also extends Style/ArrayIntersect's block-based pattern match to cover include? in addition to member?, and autocorrects it even though the cop's own docs say it "cannot guarantee array1 and array2 are actually arrays." Running brew style --fix surfaced several call sites where the second operand was actually a String, Set, or Enumerator, not an ArrayArray#intersect? would raise at runtime there. Those call sites keep the original code with a Style/ArrayIntersect disable comment explaining why; the remaining call sites were genuinely Array-to-Array and keep the intersect? rewrite.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

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

Claude Code was used to run brew vendor-gems --update=rubocop-sorbet, apply brew style --fix, and investigate/fix the Style/ArrayIntersect false-positive autocorrections described above. All changes were verified with brew typecheck, brew style, and brew tests --changed (plus --online, modulo pre-existing GitHub API rate-limit flakiness unrelated to this change).


Copilot AI review requested due to automatic review settings July 10, 2026 19:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates Homebrew’s vendored RuboCop toolchain (notably rubocop-sorbet 0.13.0) and aligns the repository’s generated artifacts and code style with the new versions, including handling Style/ArrayIntersect autocorrection cases safely.

Changes:

  • Bump rubocop-sorbet to 0.13.0 (and transitively rubocop/rubocop-ast), updating vendor/bundler setup, lockfile, and Sorbet RBIs.
  • Remove now-unnecessary Style/MutableConstant disable/enable pairs around Sorbet type_template/type_member.
  • Keep safe Array#intersect? rewrites where both operands are arrays, and add Style/ArrayIntersect disables (with rationale) where the second operand is not an Array.

Reviewed changes

Copilot reviewed 39 out of 42 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Library/Homebrew/vendor/bundle/bundler/setup.rb Updates vendored load paths for bumped RuboCop-related gem versions.
Library/Homebrew/Gemfile.lock Locks rubocop, rubocop-ast, and rubocop-sorbet to the updated versions.
Library/Homebrew/sorbet/rbi/gems/rubocop@1.88.2.rbi Updates Tapioca-generated RBI for RuboCop 1.88.2.
Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.50.0.rbi Updates Tapioca-generated RBI for rubocop-ast 1.50.0.
Library/Homebrew/utils/analytics.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/settings.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/tap.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/tab.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/tab/tab.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/keg.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/readall.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/formulary.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/formula.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/dependency_collector.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/requirement.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/requirements/xcode_requirement.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/requirements/macos_requirement.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/requirements/linux_requirement.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/requirements/arch_requirement.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/cask/tab.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/cask_dependent.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/api.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/api/internal.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/api/formula.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/api/cask.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/sorbet/rbi/shims/portable_formula.rbi Removes Style/MutableConstant disables in RBI shim.
Library/Homebrew/test/support/fixtures/testball.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/test/support/fixtures/testball_bottle.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/test/support/fixtures/formulae/install-steps.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/test/support/fixtures/failball.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/test/support/fixtures/failball_offline_install.rb Removes Style/MutableConstant disables around Sorbet cache type template.
Library/Homebrew/cache_store.rb Removes inline Style/MutableConstant disables on Sorbet type members.
Library/Homebrew/cache_store/cache_store.rb Removes inline Style/MutableConstant disables on Sorbet type members.
Library/Homebrew/unversioned_cask_checker.rb Switches nested include-check to intersect? for top-level path filtering.
Library/Homebrew/formula_cellar_checks.rb Uses intersect? to check python deps vs installed python dirs.
Library/Homebrew/formula_auditor.rb Uses intersect? to check permitted license mismatch sets vs formula licenses.
Library/Homebrew/rubocops/shell_commands.rb Adds Style/ArrayIntersect disables where RuboCop’s suggested rewrite would be unsafe.
Library/Homebrew/livecheck/livecheck.rb Adds Style/ArrayIntersect disables to avoid unsafe intersect? rewrite for String checks.
Library/Homebrew/dev-cmd/generate-zap.rb Adds Style/ArrayIntersect disables to avoid unsafe intersect? rewrite for String checks.
Library/Homebrew/cmd/info.rb Adds Style/ArrayIntersect disables where second operand is a Set, not an Array.
Library/Homebrew/cask/artifact/abstract_uninstall.rb Adds Style/ArrayIntersect disables where second operand is an Enumerator, not an Array.
Files not reviewed (1)
  • Library/Homebrew/sorbet/rbi/shims/portable_formula.rbi: File type not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/unversioned_cask_checker.rb
@dduugg dduugg force-pushed the update-rubocop-sorbet branch from 5287fd9 to 9ef35d3 Compare July 10, 2026 19:39
@dduugg dduugg enabled auto-merge July 10, 2026 19:41
Also updates rubocop (1.88.1 -> 1.88.2) and rubocop-ast (1.49.1 -> 1.50.0),
which are pulled in transitively since rubocop-sorbet has no upper bound
on its rubocop dependency.

rubocop-sorbet 0.13.0 no longer flags Sorbet type_template/type_member
constants under Style/MutableConstant, so the surrounding disable
comments (and their explanatory comments) are now dead code and removed.

rubocop 1.88.2 also extends Style/ArrayIntersect's block-based pattern
match to cover `include?`, not just `member?`, and applies its
autocorrect even though the cop's own docs note it "cannot guarantee
`array1` and `array2` are actually arrays". Several matches were on
Sets, Strings, or Enumerators, where `Array#intersect?` raises; those
call sites disable the cop with an explanation and keep the original
code. The remaining matches were genuinely between two arrays, so keep
the `intersect?` rewrite there.
@dduugg dduugg force-pushed the update-rubocop-sorbet branch from 9ef35d3 to 5b0c567 Compare July 10, 2026 20:33
@dduugg dduugg disabled auto-merge July 10, 2026 20:37
@Bo98

Bo98 commented Jul 10, 2026

Copy link
Copy Markdown
Member

rubocop 1.88.2 also extends Style/ArrayIntersect's block-based pattern match to cover include? in addition to member?, and autocorrects it even though the cop's own docs say it "cannot guarantee array1 and array2 are actually arrays."

FWIW, this is a regression introduced in 1.88.2: rubocop/rubocop#15438

@dduugg

dduugg commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

rubocop 1.88.2 also extends Style/ArrayIntersect's block-based pattern match to cover include? in addition to member?, and autocorrects it even though the cop's own docs say it "cannot guarantee array1 and array2 are actually arrays."

FWIW, this is a regression introduced in 1.88.2: rubocop/rubocop#15438

Do you want to wait until the next release? We get some fixed cases now (though i haven't confirmed if there's a strict perf improvement, or if it's just an idiomatic change), and the rubocop:disable comments will self-prune when the false positive cases are resolved by rubocop/rubocop#15439

Note that we also now see this in the brew style output 😞:

An error occurred while Style/ArrayIntersect cop was inspecting /opt/homebrew/Library/Homebrew/locale.rb:130:37.
  To see the complete backtrace run rubocop -d.
An error occurred while Style/ArrayIntersect cop was inspecting /opt/homebrew/Library/Homebrew/rubocops/unreferenced_let.rb:189:51.
  To see the complete backtrace run rubocop -d.

This could be fixed by rubocop/rubocop#15442 (though i think the PR above may handle the issue too, checking now)

@Bo98

Bo98 commented Jul 10, 2026

Copy link
Copy Markdown
Member

If brew style is actively erroring with this release we probably have to skip it yeah. False positives we can handle but errors not really.

Alternative is to disable the bugged cop temporarily.

@dduugg

dduugg commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

If brew style is actively erroring with this release we probably have to skip it yeah. False positives we can handle but errors not really.

Alternative is to disable the cop temporarily.

tbc, "brew style" still exits successfully, though maybe it shouldn't. I'm good with disabling the cop in the meantime though.

@Bo98

Bo98 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Disabling the cop sounds like best approach - keep the fixes that make sense and then disable the cop until it works without erroring. We've done many times before for situations like this.

rubocop 1.88.2's Style/ArrayIntersect autocorrects `include?`/`member?`
block patterns to `intersect?` even when the second operand isn't
actually an Array, which can raise at runtime. Disable the cop
repo-wide (to be re-enabled once rubocop/rubocop#15442 ships) rather
than disabling it at each affected call site.
@dduugg

dduugg commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

@Bo98 SGTM, PTAL at the most recent commit

@dduugg dduugg enabled auto-merge July 10, 2026 21:50
@dduugg dduugg added this pull request to the merge queue Jul 11, 2026

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @dduugg!

Merged via the queue into main with commit 6f70156 Jul 11, 2026
42 checks passed
@dduugg dduugg deleted the update-rubocop-sorbet branch July 11, 2026 07:28
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.

5 participants