rubocops/cask: No need for the first return if, [].each works OK

This commit is contained in:
Issy Long 2023-03-20 23:49:03 +00:00
parent ebdd408f99
commit 0b7bd81959
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -15,7 +15,8 @@ module RuboCop
EOS
def on_cask(cask_block)
return if (cask_stanzas = cask_block.toplevel_stanzas).empty?
cask_stanzas = cask_block.toplevel_stanzas
# Skip if there are no `on_*` blocks.
return unless (on_blocks = cask_stanzas.select { |s| ON_SYSTEM_METHODS.include?(s.stanza_name) }).any?