Merge pull request #9523 from reitermarkus/audit-url-do-verified

Ignore `verified` for `url do` blocks.
This commit is contained in:
Markus Reiter 2020-12-12 06:34:06 +01:00 committed by GitHub
commit d5283a77b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -405,6 +405,7 @@ module Cask
end
def check_missing_verified
return if cask.url.from_block?
return if url_includes_file?
return if url_match_homepage?
return if verified_present?

View File

@ -178,7 +178,7 @@ module Cask
set_unique_stanza(:url, args.empty? && options.empty? && !block_given?) do
if block_given?
LazyObject.new { URL.new(*yield, caller_location: caller_location) }
LazyObject.new { URL.new(*yield, from_block: true, caller_location: caller_location) }
else
URL.new(*args, **options, caller_location: caller_location)
end

View File

@ -31,6 +31,7 @@ class URL
header: T.nilable(String),
user_agent: T.nilable(T.any(Symbol, String)),
data: T.nilable(T::Hash[String, String]),
from_block: T::Boolean,
caller_location: Thread::Backtrace::Location,
).returns(T.untyped)
end
@ -48,6 +49,7 @@ class URL
header: nil,
user_agent: nil,
data: nil,
from_block: false,
caller_location: T.must(caller_locations).fetch(0)
)
@ -69,6 +71,7 @@ class URL
@specs = specs.compact
@from_block = from_block
@caller_location = caller_location
end
@ -93,4 +96,9 @@ class URL
interpolated_url.exclude?('#{')
end
sig { returns(T::Boolean) }
def from_block?
@from_block
end
end