resource_auditor: add audit for HEAD default branch
This commit is contained in:
parent
cd900ef71e
commit
d75320069f
@ -124,6 +124,21 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def audit_head_branch
|
||||||
|
return if !@online || !@strict || spec_name != :head || !Utils::Git.remote_exists?(url)
|
||||||
|
|
||||||
|
branch = Utils.popen_read("git", "ls-remote", "--symref", url, "HEAD")
|
||||||
|
.match(%r{ref: refs/heads/(.*?)\s+HEAD})[1]
|
||||||
|
|
||||||
|
return if branch == "master" && specs[:branch].blank? || branch == specs[:branch]
|
||||||
|
|
||||||
|
if branch == "master"
|
||||||
|
problem "Remove `branch: \"#{specs[:branch]}\"`"
|
||||||
|
else
|
||||||
|
problem "Use `branch: \"#{branch}\"` to specify the correct default branch"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def problem(text)
|
def problem(text)
|
||||||
@problems << text
|
@problems << text
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user