rubocops/cask: Check ON_SYSTEM_METHODS instead of STANZA_ORDER

- This is already here and used in multiple places. Continuing to use
  `STANZA_ORDER` will break this cop when we add `ON_SYSTEM_METHODS`
  to that list.
This commit is contained in:
Issy Long 2023-03-20 00:30:15 +00:00
parent ff2fad6bcf
commit 2c5165850a
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -21,7 +21,7 @@ module RuboCop
cask_stanzas.each do |stanza|
# Skip if the stanza is itself an `on_*` block.
next unless RuboCop::Cask::Constants::STANZA_ORDER.include?(stanza.stanza_name)
next if ON_SYSTEM_METHODS.include?(stanza.stanza_name)
# Skip if the stanza we detect is already in an `on_*` block.
next if stanza.parent_node.block_type? && ON_SYSTEM_METHODS.include?(stanza.parent_node.method_name)
# Skip if the stanza outside of a block is not also in an `on_*` block.