Add allowlist, make branch: mandatory
This commit is contained in:
parent
d75320069f
commit
f69f9be233
@ -523,9 +523,15 @@ module Homebrew
|
|||||||
spec_name = name.downcase.to_sym
|
spec_name = name.downcase.to_sym
|
||||||
next unless (spec = formula.send(spec_name))
|
next unless (spec = formula.send(spec_name))
|
||||||
|
|
||||||
|
except = @except.to_a
|
||||||
|
if spec_name == :head &&
|
||||||
|
tap_audit_exception(:head_non_default_branch_allowlist, formula.name, spec.specs[:branch])
|
||||||
|
except << "head_branch"
|
||||||
|
end
|
||||||
|
|
||||||
ra = ResourceAuditor.new(
|
ra = ResourceAuditor.new(
|
||||||
spec, spec_name,
|
spec, spec_name,
|
||||||
online: @online, strict: @strict, only: @only, except: @except
|
online: @online, strict: @strict, only: @only, except: except
|
||||||
).audit
|
).audit
|
||||||
ra.problems.each do |message|
|
ra.problems.each do |message|
|
||||||
problem "#{name}: #{message}"
|
problem "#{name}: #{message}"
|
||||||
|
|||||||
@ -125,18 +125,17 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def audit_head_branch
|
def audit_head_branch
|
||||||
return if !@online || !@strict || spec_name != :head || !Utils::Git.remote_exists?(url)
|
return unless @online
|
||||||
|
return unless @strict
|
||||||
|
return unless spec_name == :head
|
||||||
|
return unless Utils::Git.remote_exists?(url)
|
||||||
|
|
||||||
branch = Utils.popen_read("git", "ls-remote", "--symref", url, "HEAD")
|
branch = Utils.popen_read("git", "ls-remote", "--symref", url, "HEAD")
|
||||||
.match(%r{ref: refs/heads/(.*?)\s+HEAD})[1]
|
.match(%r{ref: refs/heads/(.*?)\s+HEAD})[1]
|
||||||
|
|
||||||
return if branch == "master" && specs[:branch].blank? || branch == specs[:branch]
|
return if branch == specs[:branch]
|
||||||
|
|
||||||
if branch == "master"
|
problem "Use `branch: \"#{branch}\"` to specify the default branch"
|
||||||
problem "Remove `branch: \"#{specs[:branch]}\"`"
|
|
||||||
else
|
|
||||||
problem "Use `branch: \"#{branch}\"` to specify the correct default branch"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def problem(text)
|
def problem(text)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user