[rubygems/rubygems] util/rubocop -A --only Lint/UnusedBlockArgument

https://github.com/rubygems/rubygems/commit/d8efd919db
This commit is contained in:
Hiroshi SHIBATA 2023-03-16 10:46:45 +09:00
parent 7ab4ede4f5
commit 05208c3875
33 changed files with 77 additions and 77 deletions

View File

@ -146,7 +146,7 @@ class Gem::AvailableSet
end end
def remove_installed!(dep) def remove_installed!(dep)
@set.reject! do |t| @set.reject! do |_t|
# already locally installed # already locally installed
Gem::Specification.any? do |installed_spec| Gem::Specification.any? do |installed_spec|
dep.name == installed_spec.name && dep.name == installed_spec.name &&

View File

@ -583,12 +583,12 @@ class Gem::Command
# Add the options common to all commands. # Add the options common to all commands.
add_common_option("-h", "--help", add_common_option("-h", "--help",
"Get help on this command") do |value, options| "Get help on this command") do |_value, options|
options[:help] = true options[:help] = true
end end
add_common_option("-V", "--[no-]verbose", add_common_option("-V", "--[no-]verbose",
"Set the verbose level of output") do |value, options| "Set the verbose level of output") do |value, _options|
# Set us to "really verbose" so the progress meter works # Set us to "really verbose" so the progress meter works
if Gem.configuration.verbose && value if Gem.configuration.verbose && value
Gem.configuration.verbose = 1 Gem.configuration.verbose = 1
@ -597,12 +597,12 @@ class Gem::Command
end end
end end
add_common_option("-q", "--quiet", "Silence command progress meter") do |value, options| add_common_option("-q", "--quiet", "Silence command progress meter") do |_value, _options|
Gem.configuration.verbose = false Gem.configuration.verbose = false
end end
add_common_option("--silent", add_common_option("--silent",
"Silence RubyGems output") do |value, options| "Silence RubyGems output") do |_value, options|
options[:silent] = true options[:silent] = true
end end

View File

@ -11,11 +11,11 @@ class Gem::Commands::BuildCommand < Gem::Command
add_platform_option add_platform_option
add_option "--force", "skip validation of the spec" do |value, options| add_option "--force", "skip validation of the spec" do |_value, options|
options[:force] = true options[:force] = true
end end
add_option "--strict", "consider warnings as errors when validating the spec" do |value, options| add_option "--strict", "consider warnings as errors when validating the spec" do |_value, options|
options[:strict] = true options[:strict] = true
end end

View File

@ -11,12 +11,12 @@ class Gem::Commands::CleanupCommand < Gem::Command
:check_dev => true :check_dev => true
add_option("-n", "-d", "--dry-run", add_option("-n", "-d", "--dry-run",
"Do not uninstall gems") do |value, options| "Do not uninstall gems") do |_value, options|
options[:dryrun] = true options[:dryrun] = true
end end
add_option(:Deprecated, "--dryrun", add_option(:Deprecated, "--dryrun",
"Do not uninstall gems") do |value, options| "Do not uninstall gems") do |_value, options|
options[:dryrun] = true options[:dryrun] = true
end end
deprecate_option("--dryrun", extra_msg: "Use --dry-run instead") deprecate_option("--dryrun", extra_msg: "Use --dry-run instead")

View File

@ -22,7 +22,7 @@ class Gem::Commands::ExecCommand < Gem::Command
add_option(:"Install/Update", "--conservative", add_option(:"Install/Update", "--conservative",
"Prefer the most recent installed version, ", "Prefer the most recent installed version, ",
"rather than the latest version overall") do |value, options| "rather than the latest version overall") do |_value, options|
options[:conservative] = true options[:conservative] = true
end end
end end

View File

@ -20,19 +20,19 @@ class Gem::Commands::SpecificationCommand < Gem::Command
add_prerelease_option add_prerelease_option
add_option("--all", "Output specifications for all versions of", add_option("--all", "Output specifications for all versions of",
"the gem") do |value, options| "the gem") do |_value, options|
options[:all] = true options[:all] = true
end end
add_option("--ruby", "Output ruby format") do |value, options| add_option("--ruby", "Output ruby format") do |_value, options|
options[:format] = :ruby options[:format] = :ruby
end end
add_option("--yaml", "Output YAML format") do |value, options| add_option("--yaml", "Output YAML format") do |_value, options|
options[:format] = :yaml options[:format] = :yaml
end end
add_option("--marshal", "Output Marshal format") do |value, options| add_option("--marshal", "Output Marshal format") do |_value, options|
options[:format] = :marshal options[:format] = :marshal
end end

View File

@ -79,7 +79,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
add_option("--vendor", add_option("--vendor",
"Uninstall gem from the vendor directory.", "Uninstall gem from the vendor directory.",
"Only for use by gem repackagers.") do |value, options| "Only for use by gem repackagers.") do |_value, options|
unless Gem.vendor_dir unless Gem.vendor_dir
raise Gem::OptionParser::InvalidOption.new "your platform is not supported" raise Gem::OptionParser::InvalidOption.new "your platform is not supported"
end end

View File

@ -28,7 +28,7 @@ class Gem::Commands::UnpackCommand < Gem::Command
options[:target] = value options[:target] = value
end end
add_option("--spec", "unpack the gem specification") do |value, options| add_option("--spec", "unpack the gem specification") do |_value, options|
options[:spec] = true options[:spec] = true
end end

View File

@ -300,7 +300,7 @@ command to remove old versions.
def which_to_update(highest_installed_gems, gem_names) def which_to_update(highest_installed_gems, gem_names)
result = [] result = []
highest_installed_gems.each do |l_name, l_spec| highest_installed_gems.each do |_l_name, l_spec|
next if !gem_names.empty? && next if !gem_names.empty? &&
gem_names.none? {|name| name == l_spec.name } gem_names.none? {|name| name == l_spec.name }

View File

@ -137,7 +137,7 @@ module Gem::GemcutterUtilities
request.body = URI.encode_www_form({ :api_key => api_key }.merge(update_scope_params)) request.body = URI.encode_www_form({ :api_key => api_key }.merge(update_scope_params))
end end
with_response response do |resp| with_response response do |_resp|
say "Added #{scope} scope to the existing API key" say "Added #{scope} scope to the existing API key"
end end
end end

View File

@ -49,7 +49,7 @@ module Gem::InstallUpdateOptions
add_option(:"Install/Update", "--vendor", add_option(:"Install/Update", "--vendor",
"Install gem into the vendor directory.", "Install gem into the vendor directory.",
"Only for use by gem repackagers.") do |value, options| "Only for use by gem repackagers.") do |_value, options|
unless Gem.vendor_dir unless Gem.vendor_dir
raise Gem::OptionParser::InvalidOption.new "your platform is not supported" raise Gem::OptionParser::InvalidOption.new "your platform is not supported"
end end
@ -59,7 +59,7 @@ module Gem::InstallUpdateOptions
end end
add_option(:"Install/Update", "-N", "--no-document", add_option(:"Install/Update", "-N", "--no-document",
"Disable documentation generation") do |value, options| "Disable documentation generation") do |_value, options|
options[:document] = [] options[:document] = []
end end
@ -103,21 +103,21 @@ module Gem::InstallUpdateOptions
add_option(:"Install/Update", "--development", add_option(:"Install/Update", "--development",
"Install additional development", "Install additional development",
"dependencies") do |value, options| "dependencies") do |_value, options|
options[:development] = true options[:development] = true
options[:dev_shallow] = true options[:dev_shallow] = true
end end
add_option(:"Install/Update", "--development-all", add_option(:"Install/Update", "--development-all",
"Install development dependencies for all", "Install development dependencies for all",
"gems (including dev deps themselves)") do |value, options| "gems (including dev deps themselves)") do |_value, options|
options[:development] = true options[:development] = true
options[:dev_shallow] = false options[:dev_shallow] = false
end end
add_option(:"Install/Update", "--conservative", add_option(:"Install/Update", "--conservative",
"Don't attempt to upgrade gems already", "Don't attempt to upgrade gems already",
"meeting version requirement") do |value, options| "meeting version requirement") do |_value, options|
options[:conservative] = true options[:conservative] = true
options[:minimal_deps] = true options[:minimal_deps] = true
end end
@ -135,7 +135,7 @@ module Gem::InstallUpdateOptions
add_option(:"Install/Update", "-g", "--file [FILE]", add_option(:"Install/Update", "-g", "--file [FILE]",
"Read from a gem dependencies API file and", "Read from a gem dependencies API file and",
"install the listed gems") do |v,o| "install the listed gems") do |v,_o|
v = Gem::GEM_DEP_FILES.find do |file| v = Gem::GEM_DEP_FILES.find do |file|
File.exist? file File.exist? file
end unless v end unless v
@ -153,29 +153,29 @@ module Gem::InstallUpdateOptions
add_option(:"Install/Update", "--without GROUPS", Array, add_option(:"Install/Update", "--without GROUPS", Array,
"Omit the named groups (comma separated)", "Omit the named groups (comma separated)",
"when installing from a gem dependencies", "when installing from a gem dependencies",
"file") do |v,o| "file") do |v,_o|
options[:without_groups].concat v.map {|without| without.intern } options[:without_groups].concat v.map {|without| without.intern }
end end
add_option(:"Install/Update", "--default", add_option(:"Install/Update", "--default",
"Add the gem's full specification to", "Add the gem's full specification to",
"specifications/default and extract only its bin") do |v,o| "specifications/default and extract only its bin") do |v,_o|
options[:install_as_default] = v options[:install_as_default] = v
end end
add_option(:"Install/Update", "--explain", add_option(:"Install/Update", "--explain",
"Rather than install the gems, indicate which would", "Rather than install the gems, indicate which would",
"be installed") do |v,o| "be installed") do |v,_o|
options[:explain] = v options[:explain] = v
end end
add_option(:"Install/Update", "--[no-]lock", add_option(:"Install/Update", "--[no-]lock",
"Create a lock file (when used with -g/--file)") do |v,o| "Create a lock file (when used with -g/--file)") do |v,_o|
options[:lock] = v options[:lock] = v
end end
add_option(:"Install/Update", "--[no-]suggestions", add_option(:"Install/Update", "--[no-]suggestions",
"Suggest alternates when gems are not found") do |v,o| "Suggest alternates when gems are not found") do |v,_o|
options[:suggest_alternate] = v options[:suggest_alternate] = v
end end
end end

View File

@ -39,17 +39,17 @@ module Gem::LocalRemoteOptions
def add_local_remote_options def add_local_remote_options
add_option(:"Local/Remote", "-l", "--local", add_option(:"Local/Remote", "-l", "--local",
"Restrict operations to the LOCAL domain") do |value, options| "Restrict operations to the LOCAL domain") do |_value, options|
options[:domain] = :local options[:domain] = :local
end end
add_option(:"Local/Remote", "-r", "--remote", add_option(:"Local/Remote", "-r", "--remote",
"Restrict operations to the REMOTE domain") do |value, options| "Restrict operations to the REMOTE domain") do |_value, options|
options[:domain] = :remote options[:domain] = :remote
end end
add_option(:"Local/Remote", "-b", "--both", add_option(:"Local/Remote", "-b", "--both",
"Allow LOCAL and REMOTE operations") do |value, options| "Allow LOCAL and REMOTE operations") do |_value, options|
options[:domain] = :both options[:domain] = :both
end end
@ -67,7 +67,7 @@ module Gem::LocalRemoteOptions
add_option(:"Local/Remote", "-B", "--bulk-threshold COUNT", add_option(:"Local/Remote", "-B", "--bulk-threshold COUNT",
"Threshold for switching to bulk", "Threshold for switching to bulk",
"synchronization (default #{Gem.configuration.bulk_threshold})") do "synchronization (default #{Gem.configuration.bulk_threshold})") do
|value, options| |value, _options|
Gem.configuration.bulk_threshold = value.to_i Gem.configuration.bulk_threshold = value.to_i
end end
end end
@ -77,7 +77,7 @@ module Gem::LocalRemoteOptions
def add_clear_sources_option def add_clear_sources_option
add_option(:"Local/Remote", "--clear-sources", add_option(:"Local/Remote", "--clear-sources",
"Clear the gem sources") do |value, options| "Clear the gem sources") do |_value, options|
Gem.sources = nil Gem.sources = nil
options[:sources_cleared] = true options[:sources_cleared] = true
end end
@ -119,7 +119,7 @@ module Gem::LocalRemoteOptions
def add_update_sources_option def add_update_sources_option
add_option(:Deprecated, "-u", "--[no-]update-sources", add_option(:Deprecated, "-u", "--[no-]update-sources",
"Update local source cache") do |value, options| "Update local source cache") do |value, _options|
Gem.configuration.update_sources = value Gem.configuration.update_sources = value
end end
end end

View File

@ -691,7 +691,7 @@ EOM
"package content (data.tar.gz) is missing", @gem "package content (data.tar.gz) is missing", @gem
end end
if (duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first)) && duplicates.any? if (duplicates = @files.group_by {|f| f }.select {|_k,v| v.size > 1 }.map(&:first)) && duplicates.any?
raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})" raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})"
end end
end end

View File

@ -17,7 +17,7 @@ module Gem::QueryUtils
options[:installed] = value options[:installed] = value
end end
add_option("-I", "Equivalent to --no-installed") do |value, options| add_option("-I", "Equivalent to --no-installed") do |_value, options|
options[:installed] = false options[:installed] = false
end end
@ -197,7 +197,7 @@ module Gem::QueryUtils
end end
def output_versions(output, versions) def output_versions(output, versions)
versions.each do |gem_name, matching_tuples| versions.each do |_gem_name, matching_tuples|
matching_tuples = matching_tuples.sort_by {|n,_| n.version }.reverse matching_tuples = matching_tuples.sort_by {|n,_| n.version }.reverse
platforms = Hash.new {|h,version| h[version] = [] } platforms = Hash.new {|h,version| h[version] = [] }

View File

@ -225,7 +225,7 @@ class Gem::Security::Policy
trust_dir = opt[:trust_dir] trust_dir = opt[:trust_dir]
time = Time.now time = Time.now
_, signer_digests = digests.find do |algorithm, file_digests| _, signer_digests = digests.find do |_algorithm, file_digests|
file_digests.values.first.name == Gem::Security::DIGEST_NAME file_digests.values.first.name == Gem::Security::DIGEST_NAME
end end

View File

@ -113,7 +113,7 @@ class Gem::Source::Local < Gem::Source
def download(spec, cache_dir = nil) # :nodoc: def download(spec, cache_dir = nil) # :nodoc:
load_specs :complete load_specs :complete
@specs.each do |name, data| @specs.each do |_name, data|
return data[0] if data[1].spec == spec return data[0] if data[1].spec == spec
end end

View File

@ -193,10 +193,10 @@ class Gem::SpecFetcher
matches = if matches.empty? && type != :prerelease matches = if matches.empty? && type != :prerelease
suggest_gems_from_name gem_name, :prerelease suggest_gems_from_name gem_name, :prerelease
else else
matches.uniq.sort_by {|name, dist| dist } matches.uniq.sort_by {|_name, dist| dist }
end end
matches.map {|name, dist| name }.uniq.first(num_results) matches.map {|name, _dist| name }.uniq.first(num_results)
end end
## ##

View File

@ -175,7 +175,7 @@ class Gem::Specification < Gem::BasicSpecification
end end
@@attributes = @@default_value.keys.sort_by {|s| s.to_s } @@attributes = @@default_value.keys.sort_by {|s| s.to_s }
@@array_attributes = @@default_value.reject {|k,v| v != [] }.keys @@array_attributes = @@default_value.reject {|_k,v| v != [] }.keys
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k| @@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k|
@@default_value[k].nil? @@default_value[k].nil?
end end
@ -1072,7 +1072,7 @@ class Gem::Specification < Gem::BasicSpecification
def self.find_in_unresolved_tree(path) def self.find_in_unresolved_tree(path)
unresolved_specs.each do |spec| unresolved_specs.each do |spec|
spec.traverse do |from_spec, dep, to_spec, trail| spec.traverse do |_from_spec, _dep, to_spec, trail|
if to_spec.has_conflicts? || to_spec.conficts_when_loaded_with?(trail) if to_spec.has_conflicts? || to_spec.conficts_when_loaded_with?(trail)
:next :next
else else
@ -2376,7 +2376,7 @@ class Gem::Specification < Gem::BasicSpecification
# True if this gem has the same attributes as +other+. # True if this gem has the same attributes as +other+.
def same_attributes?(spec) def same_attributes?(spec)
@@attributes.all? {|name, default| self.send(name) == spec.send(name) } @@attributes.all? {|name, _default| self.send(name) == spec.send(name) }
end end
private :same_attributes? private :same_attributes?

View File

@ -341,7 +341,7 @@ class Gem::Uninstaller
s.name == spec.name && s.full_name != spec.full_name s.name == spec.name && s.full_name != spec.full_name
end end
spec.dependent_gems(@check_dev).each do |dep_spec, dep, satlist| spec.dependent_gems(@check_dev).each do |dep_spec, dep, _satlist|
unless siblings.any? {|s| s.satisfies_requirement? dep } unless siblings.any? {|s| s.satisfies_requirement? dep }
msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}" msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}"
end end

View File

@ -87,7 +87,7 @@ class Gem::Validator
good, gone, unreadable = nil, nil, nil, nil good, gone, unreadable = nil, nil, nil, nil
File.open gem_path, Gem.binary_mode do |file| File.open gem_path, Gem.binary_mode do |_file|
package = Gem::Package.new gem_path package = Gem::Package.new gem_path
good, gone = package.contents.partition do |file_name| good, gone = package.contents.partition do |file_name|

View File

@ -1740,7 +1740,7 @@ class TestGem < Gem::TestCase
# #
# FIXME what does this solve precisely? -ebh # FIXME what does this solve precisely? -ebh
# #
@additional.each do |dir| @additional.each do |_dir|
Gem.ensure_gem_subdirectories @gemhome Gem.ensure_gem_subdirectories @gemhome
end end
end end

View File

@ -15,7 +15,7 @@ class TestGemCommand < Gem::TestCase
@common_options = Gem::Command.common_options.dup @common_options = Gem::Command.common_options.dup
Gem::Command.common_options.clear Gem::Command.common_options.clear
Gem::Command.common_options << [ Gem::Command.common_options << [
["-x", "--exe", "Execute"], lambda do |*a| ["-x", "--exe", "Execute"], lambda do |*_a|
@xopt = true @xopt = true
end end
] ]
@ -151,7 +151,7 @@ class TestGemCommand < Gem::TestCase
done = false done = false
use_ui @ui do use_ui @ui do
@cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |value, options| @cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |_value, options|
options[:help] = true options[:help] = true
done = true done = true
end end
@ -174,7 +174,7 @@ class TestGemCommand < Gem::TestCase
end end
def test_invoke_with_options def test_invoke_with_options
@cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |value, options| @cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |_value, options|
options[:help] = true options[:help] = true
end end
@ -202,13 +202,13 @@ class TestGemCommand < Gem::TestCase
end end
def test_option_recognition def test_option_recognition
@cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |value, options| @cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |_value, options|
options[:help] = true options[:help] = true
end end
@cmd.add_option("-f", "--file FILE", "File option") do |value, options| @cmd.add_option("-f", "--file FILE", "File option") do |_value, options|
options[:help] = true options[:help] = true
end end
@cmd.add_option("--silent", "Silence RubyGems output") do |value, options| @cmd.add_option("--silent", "Silence RubyGems output") do |_value, options|
options[:silent] = true options[:silent] = true
end end
assert @cmd.handles?(["-x"]) assert @cmd.handles?(["-x"])
@ -236,7 +236,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg
def initialize def initialize
super("test", "Gem::Command instance for testing") super("test", "Gem::Command instance for testing")
add_option("-t", "--test", "Test command") do |value, options| add_option("-t", "--test", "Test command") do |_value, options|
options[:test] = true options[:test] = true
end end
@ -265,7 +265,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur
def initialize def initialize
super("test", "Gem::Command instance for testing") super("test", "Gem::Command instance for testing")
add_option("-t", "--test", "Test command") do |value, options| add_option("-t", "--test", "Test command") do |_value, options|
options[:test] = true options[:test] = true
end end
@ -294,7 +294,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg
def initialize def initialize
super("test", "Gem::Command instance for testing") super("test", "Gem::Command instance for testing")
add_option("-t", "--test", "Test command") do |value, options| add_option("-t", "--test", "Test command") do |_value, options|
options[:test] = true options[:test] = true
end end
@ -323,7 +323,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur
def initialize def initialize
super("test", "Gem::Command instance for testing") super("test", "Gem::Command instance for testing")
add_option("-t", "--test", "Test command") do |value, options| add_option("-t", "--test", "Test command") do |_value, options|
options[:test] = true options[:test] = true
end end

View File

@ -63,7 +63,7 @@ class TestGemCommandsHelpCommand < Gem::TestCase
def test_gem_help_commands_omits_deprecated_commands def test_gem_help_commands_omits_deprecated_commands
mgr = Gem::CommandManager.new mgr = Gem::CommandManager.new
util_gem "commands" do |out, err| util_gem "commands" do |out, _err|
deprecated_commands = mgr.command_names.select {|cmd| mgr[cmd].deprecated? } deprecated_commands = mgr.command_names.select {|cmd| mgr[cmd].deprecated? }
deprecated_commands.each do |cmd| deprecated_commands.each do |cmd|
refute_match(/\A\s+#{cmd}\s+\S+\z/, out) refute_match(/\A\s+#{cmd}\s+\S+\z/, out)

View File

@ -561,7 +561,7 @@ class TestGemDependencyInstaller < Gem::TestCase
done_installing_called = false done_installing_called = false
Gem.done_installing do |dep_installer, specs| Gem.done_installing do |dep_installer, _specs|
done_installing_called = true done_installing_called = true
assert_empty dep_installer.document assert_empty dep_installer.document
end end

View File

@ -91,7 +91,7 @@ class TestGemExtRakeBuilder < Gem::TestCase
create_temp_mkrf_file("task :default do abort 'fail' end") create_temp_mkrf_file("task :default do abort 'fail' end")
output = [] output = []
build_rake_in(false) do |rake| build_rake_in(false) do |_rake|
error = assert_raise Gem::InstallError do error = assert_raise Gem::InstallError do
Gem::Ext::RakeBuilder.build "mkrf_conf.rb", @dest_path, output, [], nil, @ext Gem::Ext::RakeBuilder.build "mkrf_conf.rb", @dest_path, output, [], nil, @ext
end end

View File

@ -1025,7 +1025,7 @@ gem 'other', version
@gem = setup_base_gem @gem = setup_base_gem
# build old version that has a bin file # build old version that has a bin file
installer = util_setup_gem do |spec| installer = util_setup_gem do |_spec|
File.open File.join("bin", "executable"), "w" do |f| File.open File.join("bin", "executable"), "w" do |f|
f.puts "require 'code'" f.puts "require 'code'"
end end

View File

@ -77,7 +77,7 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
io = TempIO.new tar io = TempIO.new tar
Gem::Package::TarReader.new io do |tar_reader| Gem::Package::TarReader.new io do |tar_reader|
tar_reader.seek "nonexistent" do |entry| tar_reader.seek "nonexistent" do |_entry|
flunk "entry missing but entry-found block was run" flunk "entry missing but entry-found block was run"
end end

View File

@ -1142,7 +1142,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
:SSLVerifyClient => nil, :SSLVerifyClient => nil,
:SSLCertName => nil, :SSLCertName => nil,
}.merge(config)) }.merge(config))
server.mount_proc("/yaml") do |req, res| server.mount_proc("/yaml") do |_req, res|
res.body = "--- true\n" res.body = "--- true\n"
end end
server.mount_proc("/insecure_redirect") do |req, res| server.mount_proc("/insecure_redirect") do |req, res|
@ -1179,7 +1179,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
:Logger => null_logger, :Logger => null_logger,
:AccessLog => null_logger :AccessLog => null_logger
) )
s.mount_proc("/kill") {|req, res| s.shutdown } s.mount_proc("/kill") {|_req, _res| s.shutdown }
s.mount_proc("/yaml") do |req, res| s.mount_proc("/yaml") do |req, res|
if req["X-Captain"] if req["X-Captain"]
res.body = req["X-Captain"] res.body = req["X-Captain"]
@ -1193,7 +1193,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
res["Content-Type"] = "text/html" res["Content-Type"] = "text/html"
end end
end end
s.mount_proc("/yaml.Z") do |req, res| s.mount_proc("/yaml.Z") do |_req, res|
if @enable_zip if @enable_zip
res.body = Zlib::Deflate.deflate(data) res.body = Zlib::Deflate.deflate(data)
res["Content-Type"] = "text/plain" res["Content-Type"] = "text/plain"

View File

@ -248,7 +248,7 @@ class TestGemRequest < Gem::TestCase
def test_fetch_head def test_fetch_head
uri = Gem::Uri.new(URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}") uri = Gem::Uri.new(URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}")
response = util_stub_net_http(:body => "", :code => 200) do |conn| response = util_stub_net_http(:body => "", :code => 200) do |_conn|
@request = make_request(uri, Net::HTTP::Get, nil, nil) @request = make_request(uri, Net::HTTP::Get, nil, nil)
@request.fetch @request.fetch
end end

View File

@ -45,7 +45,7 @@ class TestGemRequestSet < Gem::TestCase
done_installing_ran = false done_installing_ran = false
Gem.done_installing do |installer, specs| Gem.done_installing do |_installer, _specs|
done_installing_ran = true done_installing_ran = true
end end
@ -56,7 +56,7 @@ class TestGemRequestSet < Gem::TestCase
io.puts 'gem "a"' io.puts 'gem "a"'
io.flush io.flush
result = rs.install_from_gemdeps :gemdeps => io.path do |req, installer| result = rs.install_from_gemdeps :gemdeps => io.path do |req, _installer|
installed << req.full_name installed << req.full_name
end end
@ -114,7 +114,7 @@ Gems to install:
:install_dir => "#{@gemhome}2", :install_dir => "#{@gemhome}2",
} }
rs.install_from_gemdeps options do |req, installer| rs.install_from_gemdeps options do |req, _installer|
installed << req.full_name installed << req.full_name
end end
@ -172,7 +172,7 @@ DEPENDENCIES
io.puts 'gem "b"' io.puts 'gem "b"'
end end
rs.install_from_gemdeps :gemdeps => "gem.deps.rb" do |req, installer| rs.install_from_gemdeps :gemdeps => "gem.deps.rb" do |req, _installer|
installed << req.full_name installed << req.full_name
end end
@ -226,7 +226,7 @@ end
io.puts("gemspec") io.puts("gemspec")
end end
rs.install_from_gemdeps :gemdeps => "Gemfile" do |req, installer| rs.install_from_gemdeps :gemdeps => "Gemfile" do |req, _installer|
installed << req.full_name installed << req.full_name
end end
@ -251,7 +251,7 @@ ruby "0"
io.flush io.flush
rs.install_from_gemdeps :gemdeps => io.path do |req, installer| rs.install_from_gemdeps :gemdeps => io.path do |req, _installer|
installed << req.full_name installed << req.full_name
end end
end end

View File

@ -115,7 +115,7 @@ class TestGemSilentUI < Gem::TestCase
end end
def test_new_without_dev_null def test_new_without_dev_null
File.stub(:open, ->(path, mode) { raise Errno::ENOTCAPABLE if path == IO::NULL }) do File.stub(:open, ->(path, _mode) { raise Errno::ENOTCAPABLE if path == IO::NULL }) do
Gem::SilentUI.new Gem::SilentUI.new
end end
end end

View File

@ -2930,7 +2930,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
{ b: Gem::Dependency.new("x","1") } { b: Gem::Dependency.new("x","1") }
end end
specification.define_singleton_method(:find_all_by_name) do |dep_name| specification.define_singleton_method(:find_all_by_name) do |_dep_name|
[] []
end end
@ -2957,7 +2957,7 @@ Please report a bug if this causes problems.
{ b: Gem::Dependency.new("x","1") } { b: Gem::Dependency.new("x","1") }
end end
specification.define_singleton_method(:find_all_by_name) do |dep_name| specification.define_singleton_method(:find_all_by_name) do |_dep_name|
[ [
specification.new {|s| s.name = "z", s.version = Gem::Version.new("1") }, specification.new {|s| s.name = "z", s.version = Gem::Version.new("1") },
specification.new {|s| s.name = "z", s.version = Gem::Version.new("2") }, specification.new {|s| s.name = "z", s.version = Gem::Version.new("2") },

View File

@ -425,7 +425,7 @@ class TestGemRequire < Gem::TestCase
times_called = 0 times_called = 0
Kernel.stub(:gem, ->(name, requirement) { times_called += 1 }) do Kernel.stub(:gem, ->(_name, _requirement) { times_called += 1 }) do
refute_require "default/gem" refute_require "default/gem"
end end