brew
brew copied to clipboard
Add and adjust cask rubocops to handle variables
This PR makes two rubocop changes to casks to enforce new rules about the arch
and on_arch_conditional
DSLs that have now been added. This PR will not be able to be merged until the corresponding homebrew/cask PRs (https://github.com/Homebrew/homebrew-cask/pull/129479 and https://github.com/Homebrew/homebrew-cask/pull/129480) are merged.
The first change in this PR is that use of the arch
and on_arch_conditional
DSLs is now required instead of arch = Hardware::CPU.intel? ? "intel" : "arm"
. There is an autocorrector which covers nearly all cases that we currently have in homebrew/cask (there are a few casks that did some weird things so I just fixed those manually in https://github.com/Homebrew/homebrew-cask/pull/129480).
The second change is in the way that the stanza order and stanza grouping logic works. Now, the arch
DSL and all foo = on_arch_conditional
calls will be grouped together (with arch
first) at the top of the file (note: other variable assignments that aren't arch-related are unaffected). Currently, this looks like this:
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "arm", intel: "intel"
version "1.0.0"
sha256 "..."
end
I chose this because it most closely resembles the current way things are done so it minimizes the changes necessary. However, I'm open to other ordering if desired.
Review period will end on 2022-08-11 at 22:38:24 UTC.
Review period ended.
To keep track of progress, here's a list of all of the PRs that include style fixes (some were separated so version bumps could happen at the same time):
- https://github.com/Homebrew/homebrew-cask/pull/129479
- https://github.com/Homebrew/homebrew-cask/pull/129480
- https://github.com/Homebrew/homebrew-cask-versions/pull/14481
- https://github.com/Homebrew/homebrew-cask-versions/pull/14475
- https://github.com/Homebrew/homebrew-cask-versions/pull/14476
- https://github.com/Homebrew/homebrew-cask-versions/pull/14477
- https://github.com/Homebrew/homebrew-cask-versions/pull/14478
- https://github.com/Homebrew/homebrew-cask-versions/pull/14479
- https://github.com/Homebrew/homebrew-cask-versions/pull/14480
- https://github.com/Homebrew/homebrew-cask-drivers/pull/2953
- https://github.com/Homebrew/homebrew-cask-drivers/pull/2952