summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-04 12:25:01 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-04 19:25:37 +0100
commit5c456b21162daa4cd7d4bef1b001a6899acaaeae (patch)
treeaa8d86525bbe8a45f2d53ffab683b3a9a1c9d1cd
parenta4c2a86fd9450e6824ed79a852ab1ab7ee45320e (diff)
downloadbundler-5c456b21162daa4cd7d4bef1b001a6899acaaeae.tar.gz
Move `rescue Exception` exceptions inline
-rw-r--r--.rubocop_todo.yml9
-rw-r--r--lib/bundler/cli.rb2
-rw-r--r--lib/bundler/dsl.rb2
-rw-r--r--lib/bundler/friendly_errors.rb2
-rw-r--r--lib/bundler/rubygems_integration.rb2
-rw-r--r--lib/bundler/worker.rb2
6 files changed, 5 insertions, 14 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 9d99727107..c17f201e5b 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -162,15 +162,6 @@ Lint/NestedMethodDefinition:
- 'lib/bundler/inline.rb'
- 'spec/support/builders.rb'
-# Offense count: 5
-Lint/RescueException:
- Exclude:
- - 'lib/bundler/cli.rb'
- - 'lib/bundler/dsl.rb'
- - 'lib/bundler/friendly_errors.rb'
- - 'lib/bundler/rubygems_integration.rb'
- - 'lib/bundler/worker.rb'
-
# Offense count: 2
Lint/ShadowedException:
Exclude:
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 916ae9bf78..affd7a78c1 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -16,7 +16,7 @@ module Bundler
def self.start(*)
super
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
Bundler.ui = UI::Shell.new
raise e
ensure
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 69dcc6427f..c736fc9730 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -45,7 +45,7 @@ module Bundler
@gemfiles << expanded_gemfile_path
contents ||= Bundler.read_file(@gemfile.to_s)
instance_eval(contents.dup.untaint, gemfile.to_s, 1)
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
message = "There was an error " \
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
"`#{File.basename gemfile.to_s}`: #{e.message}"
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index 451504f21d..dd9b847f10 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -123,7 +123,7 @@ module Bundler
yield
rescue SignalException
raise
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
FriendlyErrors.log_error(e)
exit FriendlyErrors.exit_status(e)
end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 783d106e7b..ee2964dab7 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -307,7 +307,7 @@ module Bundler
gem_from_path(path, security_policies[policy]).spec
rescue Gem::Package::FormatError
raise GemspecError, "Could not read gem at #{path}. It may be corrupted."
- rescue Exception, Gem::Exception, Gem::Security::Exception => e
+ rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
if e.is_a?(Gem::Security::Exception) ||
e.message =~ /unknown trust policy|unsigned gem/i ||
e.message =~ /couldn't verify (meta)?data signature/i
diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb
index e91cfa7805..1c7c1ccf6c 100644
--- a/lib/bundler/worker.rb
+++ b/lib/bundler/worker.rb
@@ -62,7 +62,7 @@ module Bundler
def apply_func(obj, i)
@func.call(obj, i)
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
WrappedException.new(e)
end