[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
Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
generate_executable_stubs
return true, post_install_message
[true, post_install_message]
rescue Bundler::InstallHookError, Bundler::SecurityError, Bundler::APIResponseMismatchError
raise
rescue Errno::ENOSPC
return false, out_of_space_message
[false, out_of_space_message]
rescue Bundler::BundlerError, Gem::InstallError, Bundler::APIResponseInvalidDependenciesError => e
return false, specific_failure_message(e)
[false, specific_failure_message(e)]
end
private

View File

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

View File

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

View File

@ -179,7 +179,7 @@ class Gem::Commands::CertCommand < Gem::Command
key = Gem::Security.create_key(algorithm)
key_path = Gem::Security.write key, "gem-private_key.pem", 0600, passphrase
return key, key_path
[key, key_path]
end
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 }
end
return nil
nil
end
def specification_directories # :nodoc:

View File

@ -16,7 +16,7 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
platform display the supported gem platforms
<omitted> display everything
EOF
return args.gsub(/^\s+/, "")
args.gsub(/^\s+/, "")
end
def description # :nodoc:
@ -170,6 +170,6 @@ lib/rubygems/defaults/operating_system.rb
end
end
return nil
nil
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"
end
return false
false
end
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 bin_dir, :mode => 0755
return lib_dir, bin_dir
[lib_dir, bin_dir]
end
def generate_default_man_dir

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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