Refactor condition.

This commit is contained in:
Markus Reiter 2024-07-30 21:48:59 +02:00
parent 77e3a405f5
commit 4a1643e7ad
No known key found for this signature in database
GPG Key ID: 245293B51702655B
2 changed files with 2 additions and 2 deletions

View File

@ -396,7 +396,7 @@ module Cask
sig { void } sig { void }
def audit_token def audit_token
token_auditor = Homebrew::FormulaNameCaskTokenAuditor.new(cask.token) token_auditor = Homebrew::FormulaNameCaskTokenAuditor.new(cask.token)
return if (errors = token_auditor.errors).empty? return if (errors = token_auditor.errors).none?
add_error "Cask token '#{cask.token}' must not contain #{errors.to_sentence(two_words_connector: " or ", add_error "Cask token '#{cask.token}' must not contain #{errors.to_sentence(two_words_connector: " or ",
last_word_connector: " or ")}." last_word_connector: " or ")}."

View File

@ -165,7 +165,7 @@ module Homebrew
name = formula.name name = formula.name
name_auditor = Homebrew::FormulaNameCaskTokenAuditor.new(name) name_auditor = Homebrew::FormulaNameCaskTokenAuditor.new(name)
unless (errors = name_auditor.errors).empty? if (errors = name_auditor.errors).any?
problem "Formula name '#{name}' must not contain #{errors.to_sentence(two_words_connector: " or ", problem "Formula name '#{name}' must not contain #{errors.to_sentence(two_words_connector: " or ",
last_word_connector: " or ")}." last_word_connector: " or ")}."
end end