Only treat cask audit warnings as errors if --strict is passed.

This commit is contained in:
Markus Reiter 2020-09-14 02:55:47 +02:00
parent e4356e85d1
commit b72e7ee34d
2 changed files with 10 additions and 10 deletions

View File

@ -30,8 +30,8 @@ module Cask
appcast = online if appcast.nil? appcast = online if appcast.nil?
download = online if download.nil? download = online if download.nil?
# `strict` implies `token_conflicts` # `new_cask` implies `token_conflicts`
token_conflicts = strict if token_conflicts.nil? token_conflicts = new_cask if token_conflicts.nil?
@cask = cask @cask = cask
@appcast = appcast @appcast = appcast
@ -91,8 +91,12 @@ module Cask
end end
def add_warning(message) def add_warning(message)
if strict?
add_error message
else
warnings << message warnings << message
end end
end
def errors? def errors?
errors.any? errors.any?
@ -299,11 +303,9 @@ module Cask
end end
def check_desc def check_desc
return unless new_cask?
return if cask.desc.present? return if cask.desc.present?
add_error "Cask should have a description. Please add a `desc` stanza." add_warning "Cask should have a description. Please add a `desc` stanza."
end end
def check_url def check_url
@ -380,7 +382,7 @@ module Cask
end end
def check_token_bad_words def check_token_bad_words
return unless strict? return unless new_cask?
token = cask.token token = cask.token

View File

@ -59,8 +59,6 @@ module Cask
odebug "Auditing Cask #{cask}" odebug "Auditing Cask #{cask}"
result = Auditor.audit(cask, **options) result = Auditor.audit(cask, **options)
next true if result[:warnings].empty? && result[:errors].empty?
if ENV["GITHUB_ACTIONS"] if ENV["GITHUB_ACTIONS"]
cask_path = cask.sourcefile_path cask_path = cask.sourcefile_path
annotations = (result[:warnings].map { |w| [:warning, w] } + result[:errors].map { |e| [:error, e] }) annotations = (result[:warnings].map { |w| [:warning, w] } + result[:errors].map { |e| [:error, e] })
@ -71,7 +69,7 @@ module Cask
end end
end end
false result[:errors].empty?
end end
return if failed_casks.empty? return if failed_casks.empty?