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?
download = online if download.nil?
# `strict` implies `token_conflicts`
token_conflicts = strict if token_conflicts.nil?
# `new_cask` implies `token_conflicts`
token_conflicts = new_cask if token_conflicts.nil?
@cask = cask
@appcast = appcast
@ -91,7 +91,11 @@ module Cask
end
def add_warning(message)
warnings << message
if strict?
add_error message
else
warnings << message
end
end
def errors?
@ -299,11 +303,9 @@ module Cask
end
def check_desc
return unless new_cask?
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
def check_url
@ -380,7 +382,7 @@ module Cask
end
def check_token_bad_words
return unless strict?
return unless new_cask?
token = cask.token

View File

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