[rubygems/rubygems] Enabled Style/RedundantReturn cop

https://github.com/rubygems/rubygems/commit/05cc97bdf8
This commit is contained in:
Hiroshi SHIBATA 2023-03-23 10:16:17 +09:00
parent 19e9c4004b
commit 2e3cd1dc3e
Notes: git 2023-03-23 08:19:21 +00:00
26 changed files with 43 additions and 45 deletions

View File

@ -16,13 +16,13 @@ module Bundler
post_install_message = install post_install_message = install
Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}" Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
generate_executable_stubs generate_executable_stubs
return true, post_install_message [true, post_install_message]
rescue Bundler::InstallHookError, Bundler::SecurityError, Bundler::APIResponseMismatchError rescue Bundler::InstallHookError, Bundler::SecurityError, Bundler::APIResponseMismatchError
raise raise
rescue Errno::ENOSPC rescue Errno::ENOSPC
return false, out_of_space_message [false, out_of_space_message]
rescue Bundler::BundlerError, Gem::InstallError, Bundler::APIResponseInvalidDependenciesError => e rescue Bundler::BundlerError, Gem::InstallError, Bundler::APIResponseInvalidDependenciesError => e
return false, specific_failure_message(e) [false, specific_failure_message(e)]
end end
private private

View File

@ -210,7 +210,7 @@ module Gem
end end
end end
return true true
end end
def self.needs def self.needs
@ -488,7 +488,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# the spec dirs directly, so we prune. # the spec dirs directly, so we prune.
files.uniq! if check_load_path files.uniq! if check_load_path
return files files
end end
def self.find_files_from_load_path(glob) # :nodoc: def self.find_files_from_load_path(glob) # :nodoc:
@ -523,7 +523,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# the spec dirs directly, so we prune. # the spec dirs directly, so we prune.
files.uniq! if check_load_path files.uniq! if check_load_path
return files files
end end
## ##

View File

@ -427,9 +427,9 @@ class Gem::Command
def handles?(args) def handles?(args)
parser.parse!(args.dup) parser.parse!(args.dup)
return true true
rescue StandardError rescue StandardError
return false false
end end
## ##

View File

@ -179,7 +179,7 @@ class Gem::Commands::CertCommand < Gem::Command
key = Gem::Security.create_key(algorithm) key = Gem::Security.create_key(algorithm)
key_path = Gem::Security.write key, "gem-private_key.pem", 0600, passphrase key_path = Gem::Security.write key, "gem-private_key.pem", 0600, passphrase
return key, key_path [key, key_path]
end end
def certificates_matching(filter) def certificates_matching(filter)

View File

@ -177,7 +177,7 @@ prefix or only the files that are requireable.
@spec_dirs.sort.each {|dir| say dir } @spec_dirs.sort.each {|dir| say dir }
end end
return nil nil
end end
def specification_directories # :nodoc: def specification_directories # :nodoc:

View File

@ -16,7 +16,7 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
platform display the supported gem platforms platform display the supported gem platforms
<omitted> display everything <omitted> display everything
EOF EOF
return args.gsub(/^\s+/, "") args.gsub(/^\s+/, "")
end end
def description # :nodoc: def description # :nodoc:
@ -170,6 +170,6 @@ lib/rubygems/defaults/operating_system.rb
end end
end end
return nil nil
end end
end end

View File

@ -356,7 +356,7 @@ By default, this RubyGems will install gem as:
say "Set the GEM_HOME environment variable if you want RDoc generated" say "Set the GEM_HOME environment variable if you want RDoc generated"
end end
return false false
end end
def install_default_bundler_gem(bin_dir) def install_default_bundler_gem(bin_dir)
@ -432,7 +432,7 @@ By default, this RubyGems will install gem as:
mkdir_p lib_dir, :mode => 0755 mkdir_p lib_dir, :mode => 0755
mkdir_p bin_dir, :mode => 0755 mkdir_p bin_dir, :mode => 0755
return lib_dir, bin_dir [lib_dir, bin_dir]
end end
def generate_default_man_dir def generate_default_man_dir

View File

@ -129,7 +129,7 @@ command help for an example.
return this_path if File.exist? this_path return this_path if File.exist? this_path
end end
return nil nil
end end
## ##

View File

@ -232,7 +232,7 @@ command to remove old versions.
highest_remote_tup = highest_remote_name_tuple(rubygems_update) highest_remote_tup = highest_remote_name_tuple(rubygems_update)
target = highest_remote_tup ? highest_remote_tup.version : version target = highest_remote_tup ? highest_remote_tup.version : version
return target, requirement [target, requirement]
end end
def update_gem(name, version = Gem::Requirement.default) def update_gem(name, version = Gem::Requirement.default)

View File

@ -142,7 +142,7 @@ module Kernel
end end
RUBYGEMS_ACTIVATION_MONITOR.exit RUBYGEMS_ACTIVATION_MONITOR.exit
return gem_original_require(path) gem_original_require(path)
rescue LoadError => load_error rescue LoadError => load_error
if load_error.path == path if load_error.path == path
RUBYGEMS_ACTIVATION_MONITOR.enter RUBYGEMS_ACTIVATION_MONITOR.enter

View File

@ -748,7 +748,7 @@ class Gem::Installer
def app_script_text(bin_file_name) def app_script_text(bin_file_name)
# NOTE: that the `load` lines cannot be indented, as old RG versions match # NOTE: that the `load` lines cannot be indented, as old RG versions match
# against the beginning of the line # against the beginning of the line
return <<-TEXT <<-TEXT
#{shebang bin_file_name} #{shebang bin_file_name}
# #
# This file was generated by RubyGems. # This file was generated by RubyGems.

View File

@ -186,7 +186,7 @@ class Gem::Package
end end
end end
return spec, metadata [spec, metadata]
end end
## ##

View File

@ -35,7 +35,7 @@ class Gem::Package::DigestIO
yield digest_io yield digest_io
return digests digests
end end
## ##

View File

@ -87,7 +87,7 @@ class Gem::Package::TarReader
return unless found return unless found
return yield found yield found
ensure ensure
rewind rewind
end end

View File

@ -323,6 +323,6 @@ class Gem::Package::TarWriter
end end
end end
return name, prefix [name, prefix]
end end
end end

View File

@ -813,7 +813,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
end end
end end
return true true
end end
## ##

View File

@ -144,7 +144,7 @@ class Gem::Resolver
activation_request = activation_request =
Gem::Resolver::ActivationRequest.new spec, dep, possible Gem::Resolver::ActivationRequest.new spec, dep, possible
return spec, activation_request [spec, activation_request]
end end
def requests(s, act, reqs=[]) # :nodoc: def requests(s, act, reqs=[]) # :nodoc:
@ -212,7 +212,7 @@ class Gem::Resolver
matching_platform = select_local_platforms all matching_platform = select_local_platforms all
return matching_platform, all [matching_platform, all]
end end
## ##

View File

@ -36,7 +36,7 @@ class Gem::SourceList
list.replace ary list.replace ary
return list list
end end
def initialize_copy(other) # :nodoc: def initialize_copy(other) # :nodoc:

View File

@ -123,7 +123,7 @@ class Gem::SpecFetcher
tuples = tuples.sort_by {|x| x[0].version } tuples = tuples.sort_by {|x| x[0].version }
return [tuples, errors] [tuples, errors]
end end
## ##
@ -161,7 +161,7 @@ class Gem::SpecFetcher
specs << [spec, source] specs << [spec, source]
end end
return [specs, errors] [specs, errors]
end end
## ##

View File

@ -1431,7 +1431,7 @@ class Gem::Specification < Gem::BasicSpecification
@activated = true @activated = true
@loaded = true @loaded = true
return true true
end end
## ##
@ -1521,7 +1521,7 @@ class Gem::Specification < Gem::BasicSpecification
executables executables
end end
rescue StandardError rescue StandardError
return nil nil
end end
## ##
@ -2382,8 +2382,8 @@ class Gem::Specification < Gem::BasicSpecification
# Checks if this specification meets the requirement of +dependency+. # Checks if this specification meets the requirement of +dependency+.
def satisfies_requirement?(dependency) def satisfies_requirement?(dependency)
return @name == dependency.name && @name == dependency.name &&
dependency.requirement.satisfied_by?(@version) dependency.requirement.satisfied_by?(@version)
end end
## ##
@ -2669,8 +2669,6 @@ class Gem::Specification < Gem::BasicSpecification
self.required_rubygems_version = "> 1.3.1" self.required_rubygems_version = "> 1.3.1"
end end
invalidate_memoized_attributes invalidate_memoized_attributes
return
end end
def stubbed? def stubbed?

View File

@ -347,7 +347,7 @@ class Gem::Uninstaller
msg << "If you remove this gem, these dependencies will not be met." msg << "If you remove this gem, these dependencies will not be met."
msg << "Continue with Uninstall?" msg << "Continue with Uninstall?"
return ask_yes_no(msg.join("\n"), false) ask_yes_no(msg.join("\n"), false)
end end
## ##

View File

@ -236,7 +236,7 @@ class Gem::StreamUI
return nil, nil unless result return nil, nil unless result
result = result.strip.to_i - 1 result = result.strip.to_i - 1
return list[result], result [list[result], result]
end end
## ##
@ -273,7 +273,7 @@ class Gem::StreamUI
end end
end end
return result result
end end
## ##

View File

@ -377,7 +377,7 @@ class Gem::Version
return lhs <=> rhs return lhs <=> rhs
end end
return 0 0
end end
def canonical_segments def canonical_segments
@ -413,6 +413,6 @@ class Gem::Version
string_start = _segments.index {|s| s.is_a?(String) } string_start = _segments.index {|s| s.is_a?(String) }
string_segments = segments string_segments = segments
numeric_segments = string_segments.slice!(0, string_start || string_segments.size) numeric_segments = string_segments.slice!(0, string_start || string_segments.size)
return numeric_segments, string_segments [numeric_segments, string_segments]
end end
end end

View File

@ -573,7 +573,7 @@ class Gem::TestCase < Test::Unit::TestCase
head = Gem::Util.popen(@git, "rev-parse", "HEAD").strip head = Gem::Util.popen(@git, "rev-parse", "HEAD").strip
end end
return name, git_spec.version, directory, head [name, git_spec.version, directory, head]
end end
## ##
@ -734,7 +734,7 @@ class Gem::TestCase < Test::Unit::TestCase
Gem::Specification.reset Gem::Specification.reset
return spec spec
end end
## ##
@ -869,7 +869,7 @@ class Gem::TestCase < Test::Unit::TestCase
FileUtils.rm spec.spec_file FileUtils.rm spec.spec_file
end end
return spec spec
end end
## ##
@ -1441,7 +1441,7 @@ Also, a list:
io.write vendor_spec.to_ruby io.write vendor_spec.to_ruby
end end
return name, vendor_spec.version, directory [name, vendor_spec.version, directory]
end end
## ##

View File

@ -536,6 +536,6 @@ class TestGemSecurityPolicy < Gem::TestCase
digests = { Gem::Security::DIGEST_NAME => { 0 => data } } digests = { Gem::Security::DIGEST_NAME => { 0 => data } }
signatures = { 0 => sign(data, key) } signatures = { 0 => sign(data, key) }
return digests, signatures [digests, signatures]
end end
end if Gem::HAVE_OPENSSL end if Gem::HAVE_OPENSSL

View File

@ -13,7 +13,7 @@ class TestGemStreamUI < Gem::TestCase
def tty? def tty?
@tty = true unless defined? @tty @tty = true unless defined? @tty
return @tty @tty
end end
alias_method :isatty, :tty? alias_method :isatty, :tty?