Skip to content

Add and adjust cask rubocops to handle variables - #13681

Merged
Rylan12 merged 2 commits into
Homebrew:masterfrom
Rylan12:cask-variables-rubocop
Aug 12, 2022
Merged

Add and adjust cask rubocops to handle variables#13681
Rylan12 merged 2 commits into
Homebrew:masterfrom
Rylan12:cask-variables-rubocop

Conversation

@Rylan12

@Rylan12 Rylan12 commented Aug 10, 2022

Copy link
Copy Markdown
Member

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 (Homebrew/homebrew-cask#129479 and Homebrew/homebrew-cask#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 Homebrew/homebrew-cask#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.

@BrewTestBot

Copy link
Copy Markdown
Contributor

Review period will end on 2022-08-11 at 22:38:24 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Aug 10, 2022
@MikeMcQuaid MikeMcQuaid added the critical Critical change which should be shipped as soon as possible. label Aug 11, 2022
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Aug 11, 2022
@BrewTestBot

BrewTestBot commented Aug 11, 2022

Copy link
Copy Markdown
Contributor

Review period ended.

@Rylan12
Rylan12 merged commit dd2b1ce into Homebrew:master Aug 12, 2022
@Rylan12
Rylan12 deleted the cask-variables-rubocop branch August 12, 2022 00:05
@github-actions github-actions Bot added the outdated PR was locked due to age label Sep 11, 2022
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants