aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMarkus Reiter2017-10-07 00:31:28 +0200
committerMarkus Reiter2017-10-08 16:10:37 +0200
commit175ca909ee1a5b57aa0cae2c879920511f311b14 (patch)
tree067464b4c08f4c16ca3439b533f06669a78c370c /Library/Homebrew/cmd
parent91ab116ace7f4f97d3440190463c93be9ec6d675 (diff)
downloadbrew-175ca909ee1a5b57aa0cae2c879920511f311b14.tar.bz2
Clean up code style and remove `.rubocop_todo.yml`.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/fetch.rb6
-rw-r--r--Library/Homebrew/cmd/install.rb1
-rw-r--r--Library/Homebrew/cmd/reinstall.rb4
-rw-r--r--Library/Homebrew/cmd/style.rb1
-rw-r--r--Library/Homebrew/cmd/tap.rb3
-rw-r--r--Library/Homebrew/cmd/update-report.rb6
-rw-r--r--Library/Homebrew/cmd/upgrade.rb1
-rw-r--r--Library/Homebrew/cmd/uses.rb6
8 files changed, 17 insertions, 11 deletions
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb
index 006c63746..411753992 100644
--- a/Library/Homebrew/cmd/fetch.rb
+++ b/Library/Homebrew/cmd/fetch.rb
@@ -49,8 +49,10 @@ module Homebrew
if fetch_bottle?(f)
begin
fetch_formula(f.bottle)
- rescue Exception => e
- raise if ARGV.homebrew_developer? || e.is_a?(Interrupt)
+ rescue Interrupt
+ raise
+ rescue => e
+ raise if ARGV.homebrew_developer?
fetched_bottle = false
onoe e.message
opoo "Bottle fetch failed: fetching the source."
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 732e96b00..ca8f29477 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -339,6 +339,7 @@ module Homebrew
rescue FormulaInstallationAlreadyAttemptedError
# We already attempted to install f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on.
+ return
rescue CannotInstallFormulaError => e
ofail e.message
end
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 94096d2dd..6727c0b6b 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -47,8 +47,8 @@ module Homebrew
fi.install
fi.finish
rescue FormulaInstallationAlreadyAttemptedError
- # next
- rescue Exception
+ return
+ rescue Exception # rubocop:disable Lint/RescueException
ignore_interrupts { restore_backup(keg, keg_was_linked) }
raise
else
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index e816db5dc..58f430a27 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -117,6 +117,7 @@ module Homebrew
case output_type
when :print
+ args << "--debug" if ARGV.debug?
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
args << "--format" << "simple" if files
system(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", *args)
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb
index 2a07c1b2f..fa520e2c5 100644
--- a/Library/Homebrew/cmd/tap.rb
+++ b/Library/Homebrew/cmd/tap.rb
@@ -54,8 +54,7 @@ module Homebrew
quiet: ARGV.quieter?
rescue TapRemoteMismatchError => e
odie e
- rescue TapAlreadyTappedError, TapAlreadyUnshallowError
- # Do nothing.
+ rescue TapAlreadyTappedError, TapAlreadyUnshallowError # rubocop:disable Lint/HandleExceptions
end
end
end
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index 781ee8808..0974df0b4 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -372,7 +372,7 @@ class Reporter
new_version = formula.pkg_version
old_version = FormulaVersions.new(formula).formula_at_revision(@initial_revision, &:pkg_version)
next if new_version == old_version
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer?
end
@report[:M] << tap.formula_file_to_name(src)
@@ -460,7 +460,7 @@ class Reporter
unless Formulary.factory(new_full_name).keg_only?
system HOMEBREW_BREW_FILE, "link", new_full_name, "--overwrite"
end
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer?
end
next
@@ -521,7 +521,7 @@ class Reporter
begin
f = Formulary.factory(new_full_name)
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer?
next
end
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 1cdb497cf..f1ce3c7da 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -150,6 +150,7 @@ module Homebrew
rescue FormulaInstallationAlreadyAttemptedError
# We already attempted to upgrade f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on.
+ return
rescue CannotInstallFormulaError => e
ofail e
rescue BuildError => e
diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index 24684c3b6..0b09e1bf1 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -74,12 +74,13 @@ module Homebrew
end
end
- dep_formulae = deps.map do |dep|
+ dep_formulae = deps.flat_map do |dep|
begin
dep.to_formula
rescue
+ []
end
- end.compact
+ end
reqs_by_formula = ([f] + dep_formulae).flat_map do |formula|
formula.requirements.map { |req| [formula, req] }
@@ -118,6 +119,7 @@ module Homebrew
rescue FormulaUnavailableError
# Silently ignore this case as we don't care about things used in
# taps that aren't currently tapped.
+ next
end
end
end