diff options
| author | Mike McQuaid | 2016-09-11 17:47:04 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2016-09-11 19:13:00 +0100 |
| commit | 6cfb84152464097901a9b9a437b37cc8c5aeb45c (patch) | |
| tree | 3a919b1bfc45c2b7f0653a458439582428c92d77 /Library/Homebrew | |
| parent | 3bf5e779ab04bf399963183eb59f815b5df77c5d (diff) | |
| download | brew-6cfb84152464097901a9b9a437b37cc8c5aeb45c.tar.bz2 | |
utils/github: fix Rubocop warnings.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/utils/github.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index fce89f1af..d3f304122 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -121,7 +121,7 @@ module GitHub 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. return if ENV["HOMEBREW_NO_GITHUB_API"] @@ -154,7 +154,7 @@ module GitHub args += ["--data", "@#{data_tmpfile.path}"] 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, _, http_code = output.rpartition("\n") @@ -203,11 +203,15 @@ module GitHub case http_code when "401", "403" - raise AuthenticationFailedError.new(output) + raise AuthenticationFailedError, output when "404" raise HTTPNotFoundError, output else - error = Utils::JSON.load(output)["message"] rescue nil + error = begin + Utils::JSON.load(output)["message"] + rescue + nil + end error ||= "curl failed! #{errors}" raise Error, error end @@ -232,7 +236,7 @@ module GitHub def build_search_qualifier_string(qualifiers) { :repo => "Homebrew/homebrew-core", - :in => "title" + :in => "title", }.update(qualifiers).map do |qualifier, value| "#{qualifier}:#{value}" end.join("+") |
