From fe2d51e0b9d4d9c138e512c245b1ed8d0f1dbf53 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 23 Sep 2016 11:01:40 +0200 Subject: Fix Style/IfUnlessModifier. --- Library/Homebrew/utils/git.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Library/Homebrew/utils') diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index 837cc22e4..dfe47f890 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -22,9 +22,7 @@ module Utils return if git_available? # we cannot install brewed git if homebrew/core is unavailable. - unless CoreTap.instance.installed? - raise "Git is unavailable" - end + raise "Git is unavailable" unless CoreTap.instance.installed? begin oh1 "Installing git" -- cgit v1.2.3 From 25d5f74f3ef54aba3baa43c4adcd323f2cb0fdc6 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 23 Sep 2016 17:36:27 +0200 Subject: Fix Style/ModuleFunction. --- Library/Homebrew/utils/github.rb | 3 ++- Library/Homebrew/utils/json.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/utils') diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 654272363..b7ec538f9 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -2,7 +2,8 @@ require "uri" require "tempfile" module GitHub - extend self + module_function + ISSUES_URI = URI.parse("https://api.github.com/search/issues") Error = Class.new(RuntimeError) diff --git a/Library/Homebrew/utils/json.rb b/Library/Homebrew/utils/json.rb index 8a8cb6847..19d32a1e1 100644 --- a/Library/Homebrew/utils/json.rb +++ b/Library/Homebrew/utils/json.rb @@ -2,7 +2,7 @@ require "vendor/okjson" module Utils module JSON - extend self + module_function Error = Class.new(StandardError) -- cgit v1.2.3 From 58e36c73193befb57d351344cea2a4a33fef850d Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 23 Sep 2016 22:02:23 +0200 Subject: Fix Style/GuardClause. --- Library/Homebrew/utils/popen.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'Library/Homebrew/utils') diff --git a/Library/Homebrew/utils/popen.rb b/Library/Homebrew/utils/popen.rb index 76e67b3a9..350d9a09f 100644 --- a/Library/Homebrew/utils/popen.rb +++ b/Library/Homebrew/utils/popen.rb @@ -14,11 +14,8 @@ module Utils def self.popen(args, mode) IO.popen("-", mode) do |pipe| if pipe - if block_given? - yield pipe - else - return pipe.read - end + return pipe.read unless block_given? + yield pipe else $stderr.reopen("/dev/null", "w") exec(*args) -- cgit v1.2.3