Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rubocops/cask/stanza_order: Ensure arch and os are adjacent #19507

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/rubocops/cask/constants/stanza.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Constants

STANZA_GROUPS = T.let(
[
[:arch, :on_arch_conditional],
[:arch, :on_arch_conditional, :os],
[:version, :sha256],
ON_SYSTEM_METHODS_STANZA_ORDER,
[:language],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
os macos: ">= :big_sur"

version :latest
sha256 :no_check
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
it "reports an offense when an `arch` stanza is out of order" do
expect_offense <<~CASK
cask 'foo' do
os macos: ">= :big_sur"
^^^^^^^^^^^^^^^^^^^^^^^ `os` stanza out of order
version :latest
^^^^^^^^^^^^^^^ `version` stanza out of order
sha256 :no_check
Expand All @@ -56,6 +58,7 @@
expect_correction <<~CASK
cask 'foo' do
arch arm: "arm", intel: "x86_64"
os macos: ">= :big_sur"
version :latest
sha256 :no_check
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cask "sha256-os" do
os macos: "darwin", linux: "linux"
arch arm: "arm", intel: "intel"
os macos: "darwin", linux: "linux"

version "1.2.3"
sha256 arm: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94",
Expand Down
Loading