diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-03-16 13:47:12 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2023-03-17 18:50:55 +0900 |
commit | 6ad269dc39ab6bdf7ef195a048fa10b642374826 (patch) | |
tree | 6ba6dfbc3b6ecd67a10ae2cd4c8b5c6428838ce8 /lib | |
parent | 70164eec0f48a691dd039f55ac897036aa32e5cf (diff) |
[rubygems/rubygems] util/rubocop -A --only Style/RescueStandardError
https://github.com/rubygems/rubygems/commit/80b57da926
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems/command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/check_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/owner_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/specification_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/yank_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/defaults.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/ext/builder.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/ext/cargo_builder.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/gem_runner.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/remote_fetcher.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/security/signer.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/source.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/update_suggestion.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/util.rb | 2 |
16 files changed, 20 insertions, 20 deletions
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb index da3e22ef1b..ab21013c2a 100644 --- a/lib/rubygems/command.rb +++ b/lib/rubygems/command.rb @@ -432,7 +432,7 @@ class Gem::Command begin parser.parse!(args.dup) return true - rescue + rescue StandardError return false end end diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb index e3c288d659..ff15fa11b0 100644 --- a/lib/rubygems/commands/check_command.rb +++ b/lib/rubygems/commands/check_command.rb @@ -42,7 +42,7 @@ class Gem::Commands::CheckCommand < Gem::Command say gems = begin get_all_gem_names - rescue + rescue StandardError [] end diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb index 0ef8c45e97..4751928682 100644 --- a/lib/rubygems/commands/owner_command.rb +++ b/lib/rubygems/commands/owner_command.rb @@ -98,7 +98,7 @@ permission to. action = method == :delete ? "Removing" : "Adding" with_response response, "#{action} #{owner}" - rescue + rescue StandardError # ignore end end diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb index 6025660498..fc2fb49ceb 100644 --- a/lib/rubygems/commands/specification_command.rb +++ b/lib/rubygems/commands/specification_command.rb @@ -108,7 +108,7 @@ Specific fields in the specification can be extracted in YAML format: if File.exist? gem begin specs << Gem::Package.new(gem).spec - rescue + rescue StandardError nil end end diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb index 1499f72f5d..f4e962f201 100644 --- a/lib/rubygems/commands/yank_command.rb +++ b/lib/rubygems/commands/yank_command.rb @@ -88,7 +88,7 @@ data you will need to change them immediately and yank your gem. def get_version_from_requirements(requirements) requirements.requirements.first[1].version - rescue + rescue StandardError nil end diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb index 1de9246704..a1fdb00339 100644 --- a/lib/rubygems/defaults.rb +++ b/lib/rubygems/defaults.rb @@ -79,7 +79,7 @@ module Gem def self.find_home Dir.home.dup - rescue + rescue StandardError if Gem.win_platform? File.expand_path File.join(ENV["HOMEDRIVE"] || ENV["SystemDrive"], "/") else @@ -185,7 +185,7 @@ module Gem def self.default_exec_format exec_format = begin RbConfig::CONFIG["ruby_install_name"].sub("ruby", "%s") - rescue + rescue StandardError "%s" end diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index 02ca000984..e1b4f56fe8 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -74,7 +74,7 @@ class Gem::Ext::Builder build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env) output, status = begin Open3.capture2e(build_env, *command, :chdir => dir) - rescue => error + rescue StandardError => error raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}" end if verbose @@ -174,7 +174,7 @@ EOF verbose { results.join("\n") } write_gem_make_out results.join "\n" - rescue => e + rescue StandardError => e results << e.message build_error(results.join("\n"), $@) end diff --git a/lib/rubygems/ext/cargo_builder.rb b/lib/rubygems/ext/cargo_builder.rb index 022aabf481..fe59151331 100644 --- a/lib/rubygems/ext/cargo_builder.rb +++ b/lib/rubygems/ext/cargo_builder.rb @@ -199,7 +199,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder output, status = begin Open3.capture2e(cargo, "metadata", "--no-deps", "--format-version", "1", :chdir => cargo_dir) - rescue => error + rescue StandardError => error raise Gem::InstallError, "cargo metadata failed #{error.message}" end diff --git a/lib/rubygems/gem_runner.rb b/lib/rubygems/gem_runner.rb index 2ef043aff4..61ae306ae5 100644 --- a/lib/rubygems/gem_runner.rb +++ b/lib/rubygems/gem_runner.rb @@ -34,7 +34,7 @@ class Gem::GemRunner begin Gem.load_env_plugins - rescue + rescue StandardError nil end Gem.load_plugins diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index fdabe8d691..0e5905e8bf 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -669,7 +669,7 @@ EOM when "data.tar.gz" then verify_gz entry end - rescue + rescue StandardError warn "Exception while verifying #{@gem.path}" raise end diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb index cab2a4b0fe..d33bfd2668 100644 --- a/lib/rubygems/remote_fetcher.rb +++ b/lib/rubygems/remote_fetcher.rb @@ -126,7 +126,7 @@ class Gem::RemoteFetcher require "fileutils" begin FileUtils.mkdir_p cache_dir - rescue + rescue StandardError nil end unless File.exist? cache_dir @@ -286,7 +286,7 @@ class Gem::RemoteFetcher def cache_update_path(uri, path = nil, update = true) mtime = begin path && File.stat(path).mtime - rescue + rescue StandardError nil end diff --git a/lib/rubygems/security/signer.rb b/lib/rubygems/security/signer.rb index 78e10a995f..4540ed3cf2 100644 --- a/lib/rubygems/security/signer.rb +++ b/lib/rubygems/security/signer.rb @@ -176,14 +176,14 @@ class Gem::Security::Signer disk_cert_path = File.join(Gem.default_cert_path) disk_cert = begin File.read(disk_cert_path) - rescue + rescue StandardError nil end disk_key_path = File.join(Gem.default_key_path) disk_key = begin OpenSSL::PKey.read(File.read(disk_key_path), @passphrase) - rescue + rescue StandardError nil end diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb index c57b173a44..072103e8af 100644 --- a/lib/rubygems/source.rb +++ b/lib/rubygems/source.rb @@ -137,7 +137,7 @@ class Gem::Source spec = Gem.read_binary local_spec spec = begin Marshal.load(spec) - rescue + rescue StandardError nil end return spec if spec diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index f34741b9c9..7aa76b40f6 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1520,7 +1520,7 @@ class Gem::Specification < Gem::BasicSpecification else executables end - rescue + rescue StandardError return nil end diff --git a/lib/rubygems/update_suggestion.rb b/lib/rubygems/update_suggestion.rb index c2e81b2374..4cf085fd4c 100644 --- a/lib/rubygems/update_suggestion.rb +++ b/lib/rubygems/update_suggestion.rb @@ -59,7 +59,7 @@ Run `gem update --system #{Gem.latest_rubygems_version}` to update your installa return eglible end - rescue # don't block install command on any problem + rescue StandardError # don't block install command on any problem false end diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb index 15b5640de4..fe09190cc1 100644 --- a/lib/rubygems/util.rb +++ b/lib/rubygems/util.rb @@ -85,7 +85,7 @@ module Gem::Util loop do begin Dir.chdir here, &block - rescue + rescue StandardError Errno::EACCES end |