formula_auditor: repo should never be nil, so use T.must

https://github.com/Homebrew/brew/pull/18004#discussion_r1712680763
This commit is contained in:
Issy Long 2024-08-10 21:44:26 +01:00
parent b6fbd51f0e
commit 621ddc60d1
No known key found for this signature in database

View File

@ -776,28 +776,24 @@ module Homebrew
problem "#{stable.version} is a development release" problem "#{stable.version} is a development release"
when %r{https?://gitlab\.com/([\w-]+)/([\w-]+)} when %r{https?://gitlab\.com/([\w-]+)/([\w-]+)}
owner = Regexp.last_match(1) owner = T.must(T.must(Regexp.last_match(1)))
repo = Regexp.last_match(2) repo = T.must(T.must(Regexp.last_match(2)))
tag = SharedAudits.gitlab_tag_from_url(url) tag = SharedAudits.gitlab_tag_from_url(url)
tag ||= stable.specs[:tag] tag ||= stable.specs[:tag]
tag ||= stable.version tag ||= stable.version
if @online if @online
return if owner.nil? || repo.nil?
error = SharedAudits.gitlab_release(owner, repo, tag, formula:) error = SharedAudits.gitlab_release(owner, repo, tag, formula:)
problem error if error problem error if error
end end
when %r{^https://github.com/([\w-]+)/([\w-]+)} when %r{^https://github.com/([\w-]+)/([\w-]+)}
owner = Regexp.last_match(1) owner = T.must(Regexp.last_match(1))
repo = Regexp.last_match(2) repo = T.must(Regexp.last_match(2))
tag = SharedAudits.github_tag_from_url(url) tag = SharedAudits.github_tag_from_url(url)
tag ||= formula.stable.specs[:tag] tag ||= formula.stable.specs[:tag]
if @online if @online
return if owner.nil? || repo.nil?
error = SharedAudits.github_release(owner, repo, tag, formula:) error = SharedAudits.github_release(owner, repo, tag, formula:)
problem error if error problem error if error
end end