utils/github: fix Rubocop warnings.
This commit is contained in:
parent
3bf5e779ab
commit
6cfb841524
@ -121,7 +121,7 @@ module GitHub
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def open(url, data=nil)
|
def open(url, data = nil)
|
||||||
# This is a no-op if the user is opting out of using the GitHub API.
|
# This is a no-op if the user is opting out of using the GitHub API.
|
||||||
return if ENV["HOMEBREW_NO_GITHUB_API"]
|
return if ENV["HOMEBREW_NO_GITHUB_API"]
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ module GitHub
|
|||||||
args += ["--data", "@#{data_tmpfile.path}"]
|
args += ["--data", "@#{data_tmpfile.path}"]
|
||||||
end
|
end
|
||||||
|
|
||||||
args += ["--dump-header", "#{headers_tmpfile.path}"]
|
args += ["--dump-header", headers_tmpfile.path.to_s]
|
||||||
|
|
||||||
output, errors, status = curl_output(url.to_s, *args)
|
output, errors, status = curl_output(url.to_s, *args)
|
||||||
output, _, http_code = output.rpartition("\n")
|
output, _, http_code = output.rpartition("\n")
|
||||||
@ -203,11 +203,15 @@ module GitHub
|
|||||||
|
|
||||||
case http_code
|
case http_code
|
||||||
when "401", "403"
|
when "401", "403"
|
||||||
raise AuthenticationFailedError.new(output)
|
raise AuthenticationFailedError, output
|
||||||
when "404"
|
when "404"
|
||||||
raise HTTPNotFoundError, output
|
raise HTTPNotFoundError, output
|
||||||
else
|
else
|
||||||
error = Utils::JSON.load(output)["message"] rescue nil
|
error = begin
|
||||||
|
Utils::JSON.load(output)["message"]
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end
|
||||||
error ||= "curl failed! #{errors}"
|
error ||= "curl failed! #{errors}"
|
||||||
raise Error, error
|
raise Error, error
|
||||||
end
|
end
|
||||||
@ -232,7 +236,7 @@ module GitHub
|
|||||||
def build_search_qualifier_string(qualifiers)
|
def build_search_qualifier_string(qualifiers)
|
||||||
{
|
{
|
||||||
:repo => "Homebrew/homebrew-core",
|
:repo => "Homebrew/homebrew-core",
|
||||||
:in => "title"
|
:in => "title",
|
||||||
}.update(qualifiers).map do |qualifier, value|
|
}.update(qualifiers).map do |qualifier, value|
|
||||||
"#{qualifier}:#{value}"
|
"#{qualifier}:#{value}"
|
||||||
end.join("+")
|
end.join("+")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user