Update rubocop-sorbet to 0.13.0#23052
Conversation
There was a problem hiding this comment.
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-sorbetto 0.13.0 (and transitivelyrubocop/rubocop-ast), updating vendor/bundler setup, lockfile, and Sorbet RBIs. - Remove now-unnecessary
Style/MutableConstantdisable/enable pairs around Sorbettype_template/type_member. - Keep safe
Array#intersect?rewrites where both operands are arrays, and addStyle/ArrayIntersectdisables (with rationale) where the second operand is not anArray.
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.
5287fd9 to
9ef35d3
Compare
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.
9ef35d3 to
5b0c567
Compare
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 This could be fixed by rubocop/rubocop#15442 (though i think the PR above may handle the issue too, checking now) |
|
If Alternative is to disable the bugged cop temporarily. |
tbc, "brew style" still exits successfully, though maybe it shouldn't. I'm good with disabling the cop in the meantime though. |
|
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.
|
@Bo98 SGTM, PTAL at the most recent commit |
Updates
rubocop-sorbetto 0.13.0. This has no upper bound on itsrubocopdependency, sorubocop(1.88.1 -> 1.88.2) andrubocop-ast(1.49.1 -> 1.50.0) were also pulled in transitively;Gemfile.lock, the vendored standalone Bundler setup, and the Tapioca gem RBIs forrubocop/rubocop-astare updated to match.rubocop-sorbet0.13.0 no longer flags Sorbettype_template/type_memberconstants underStyle/MutableConstant, so the now-unnecessaryrubocop:disable/rubocop:enablecomment pairs (and their explanatory comments) are removed.rubocop1.88.2 also extendsStyle/ArrayIntersect's block-based pattern match to coverinclude?in addition tomember?, and autocorrects it even though the cop's own docs say it "cannot guaranteearray1andarray2are actually arrays." Runningbrew style --fixsurfaced several call sites where the second operand was actually aString,Set, orEnumerator, not anArray—Array#intersect?would raise at runtime there. Those call sites keep the original code with aStyle/ArrayIntersectdisable comment explaining why; the remaining call sites were genuinelyArray-to-Arrayand keep theintersect?rewrite.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code was used to run
brew vendor-gems --update=rubocop-sorbet, applybrew style --fix, and investigate/fix theStyle/ArrayIntersectfalse-positive autocorrections described above. All changes were verified withbrew typecheck,brew style, andbrew tests --changed(plus--online, modulo pre-existing GitHub API rate-limit flakiness unrelated to this change).