Merge pull request #13749 from Rylan12/include-on-system-rubocop

Include `on_{system}` blocks as stanzas in rubocop
This commit is contained in:
Rylan Polster 2022-08-24 10:30:14 -04:00 committed by GitHub
commit 4de680688e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 3 deletions

View File

@ -49,7 +49,7 @@ module RuboCop
stanzas.sort do |s1, s2|
i1 = stanza_order_index(s1)
i2 = stanza_order_index(s2)
if i1 == i2
if i1 == i2 || i1.blank? || i2.blank?
i1 = stanzas.index(s1)
i2 = stanzas.index(s2)
end

View File

@ -55,6 +55,8 @@ module RuboCop
end.freeze
STANZA_ORDER = STANZA_GROUPS.flatten.freeze
ON_SYSTEM_METHODS = [:arm, :intel, *MacOSVersions::SYMBOLS.keys].map { |option| :"on_#{option}" }.freeze
end
end
end

View File

@ -19,8 +19,10 @@ module RuboCop
def stanza?
return true if arch_variable?
return false if !send_type? && !block_type?
return true if ON_SYSTEM_METHODS.include?(method_name)
(send_type? || block_type?) && STANZA_ORDER.include?(method_name)
STANZA_ORDER.include?(method_name)
end
def heredoc?

View File

@ -9,7 +9,6 @@ cask "multiple-versions" do
version "1.2.0"
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
end
on_catalina :or_older do
version "1.0.0"
sha256 "1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216"