diff options
| author | Markus Reiter | 2016-09-23 22:02:23 +0200 |
|---|---|---|
| committer | Markus Reiter | 2016-09-24 12:24:35 +0200 |
| commit | 58e36c73193befb57d351344cea2a4a33fef850d (patch) | |
| tree | 3d26751835440341e5a42a189cf580e6253785df /Library/Homebrew/utils.rb | |
| parent | bbc3f1c3a852e6cfd26a7a7c333092fae0520eb4 (diff) | |
| download | brew-58e36c73193befb57d351344cea2a4a33fef850d.tar.bz2 | |
Fix Style/GuardClause.
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index be629f1df..58083fe1b 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -218,13 +218,9 @@ def interactive_shell(f = nil) Process.wait fork { exec ENV["SHELL"] } - if $?.success? - return - elsif $?.exited? - raise "Aborted due to non-zero exit status (#{$?.exitstatus})" - else - raise $?.inspect - end + return if $?.success? + raise "Aborted due to non-zero exit status (#{$?.exitstatus})" if $?.exited? + raise $?.inspect end module Homebrew @@ -325,13 +321,12 @@ module Homebrew end end - if $times.nil? - $times = {} - at_exit do - col_width = [$times.keys.map(&:size).max + 2, 15].max - $times.sort_by { |_k, v| v }.each do |method, time| - puts format("%-*s %0.4f sec", col_width, "#{method}:", time) - end + return unless $times.nil? + $times = {} + at_exit do + col_width = [$times.keys.map(&:size).max + 2, 15].max + $times.sort_by { |_k, v| v }.each do |method, time| + puts format("%-*s %0.4f sec", col_width, "#{method}:", time) end end end @@ -608,14 +603,14 @@ def link_src_dst_dirs(src_dir, dst_dir, command, link_dir: false) dst_dir.parent.mkpath dst.make_relative_symlink(src) end - unless conflicts.empty? - onoe <<-EOS.undent - Could not link: - #{conflicts.join("\n")} - Please delete these paths and run `#{command}`. - EOS - end + return if conflicts.empty? + onoe <<-EOS.undent + Could not link: + #{conflicts.join("\n")} + + Please delete these paths and run `#{command}`. + EOS end def link_path_manpages(path, command) |
