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 end
def check_missing_verified def check_missing_verified
return if cask.url.from_block?
return if url_includes_file? return if url_includes_file?
return if url_match_homepage? return if url_match_homepage?
return if verified_present? return if verified_present?

View File

@ -178,7 +178,7 @@ module Cask
set_unique_stanza(:url, args.empty? && options.empty? && !block_given?) do set_unique_stanza(:url, args.empty? && options.empty? && !block_given?) do
if block_given? 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 else
URL.new(*args, **options, caller_location: caller_location) URL.new(*args, **options, caller_location: caller_location)
end end

View File

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