From 05208c3875a12a188e14328ffbd5b2eb21824f24 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 16 Mar 2023 10:46:45 +0900 Subject: [PATCH] [rubygems/rubygems] util/rubocop -A --only Lint/UnusedBlockArgument https://github.com/rubygems/rubygems/commit/d8efd919db --- lib/rubygems/available_set.rb | 2 +- lib/rubygems/command.rb | 8 +++---- lib/rubygems/commands/build_command.rb | 4 ++-- lib/rubygems/commands/cleanup_command.rb | 4 ++-- lib/rubygems/commands/exec_command.rb | 2 +- .../commands/specification_command.rb | 8 +++---- lib/rubygems/commands/uninstall_command.rb | 2 +- lib/rubygems/commands/unpack_command.rb | 2 +- lib/rubygems/commands/update_command.rb | 2 +- lib/rubygems/gemcutter_utilities.rb | 2 +- lib/rubygems/install_update_options.rb | 22 +++++++++---------- lib/rubygems/local_remote_options.rb | 12 +++++----- lib/rubygems/package.rb | 2 +- lib/rubygems/query_utils.rb | 4 ++-- lib/rubygems/security/policy.rb | 2 +- lib/rubygems/source/local.rb | 2 +- lib/rubygems/spec_fetcher.rb | 4 ++-- lib/rubygems/specification.rb | 6 ++--- lib/rubygems/uninstaller.rb | 2 +- lib/rubygems/validator.rb | 2 +- test/rubygems/test_gem.rb | 2 +- test/rubygems/test_gem_command.rb | 20 ++++++++--------- .../test_gem_commands_help_command.rb | 2 +- .../rubygems/test_gem_dependency_installer.rb | 2 +- test/rubygems/test_gem_ext_rake_builder.rb | 2 +- test/rubygems/test_gem_installer.rb | 2 +- test/rubygems/test_gem_package_tar_reader.rb | 2 +- test/rubygems/test_gem_remote_fetcher.rb | 6 ++--- test/rubygems/test_gem_request.rb | 2 +- test/rubygems/test_gem_request_set.rb | 12 +++++----- test/rubygems/test_gem_silent_ui.rb | 2 +- test/rubygems/test_gem_specification.rb | 4 ++-- test/rubygems/test_require.rb | 2 +- 33 files changed, 77 insertions(+), 77 deletions(-) diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb index 58b601f6b0..50359168b5 100644 --- a/lib/rubygems/available_set.rb +++ b/lib/rubygems/available_set.rb @@ -146,7 +146,7 @@ class Gem::AvailableSet end def remove_installed!(dep) - @set.reject! do |t| + @set.reject! do |_t| # already locally installed Gem::Specification.any? do |installed_spec| dep.name == installed_spec.name && diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb index cd6af51d78..df3f23392e 100644 --- a/lib/rubygems/command.rb +++ b/lib/rubygems/command.rb @@ -583,12 +583,12 @@ class Gem::Command # Add the options common to all commands. add_common_option("-h", "--help", - "Get help on this command") do |value, options| + "Get help on this command") do |_value, options| options[:help] = true end 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 if Gem.configuration.verbose && value Gem.configuration.verbose = 1 @@ -597,12 +597,12 @@ class Gem::Command 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 end add_common_option("--silent", - "Silence RubyGems output") do |value, options| + "Silence RubyGems output") do |_value, options| options[:silent] = true end diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index 5d6152d3b9..1dd4de8c48 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -11,11 +11,11 @@ class Gem::Commands::BuildCommand < Gem::Command 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 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 end diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb index 1ae84924c1..beeb9b161f 100644 --- a/lib/rubygems/commands/cleanup_command.rb +++ b/lib/rubygems/commands/cleanup_command.rb @@ -11,12 +11,12 @@ class Gem::Commands::CleanupCommand < Gem::Command :check_dev => true add_option("-n", "-d", "--dry-run", - "Do not uninstall gems") do |value, options| + "Do not uninstall gems") do |_value, options| options[:dryrun] = true end add_option(:Deprecated, "--dryrun", - "Do not uninstall gems") do |value, options| + "Do not uninstall gems") do |_value, options| options[:dryrun] = true end deprecate_option("--dryrun", extra_msg: "Use --dry-run instead") diff --git a/lib/rubygems/commands/exec_command.rb b/lib/rubygems/commands/exec_command.rb index 1d7e836ed0..3855dc47bb 100644 --- a/lib/rubygems/commands/exec_command.rb +++ b/lib/rubygems/commands/exec_command.rb @@ -22,7 +22,7 @@ class Gem::Commands::ExecCommand < Gem::Command add_option(:"Install/Update", "--conservative", "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 end end diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb index 0bb24c2415..5cdf5966d2 100644 --- a/lib/rubygems/commands/specification_command.rb +++ b/lib/rubygems/commands/specification_command.rb @@ -20,19 +20,19 @@ class Gem::Commands::SpecificationCommand < Gem::Command add_prerelease_option add_option("--all", "Output specifications for all versions of", - "the gem") do |value, options| + "the gem") do |_value, options| options[:all] = true end - add_option("--ruby", "Output ruby format") do |value, options| + add_option("--ruby", "Output ruby format") do |_value, options| options[:format] = :ruby end - add_option("--yaml", "Output YAML format") do |value, options| + add_option("--yaml", "Output YAML format") do |_value, options| options[:format] = :yaml end - add_option("--marshal", "Output Marshal format") do |value, options| + add_option("--marshal", "Output Marshal format") do |_value, options| options[:format] = :marshal end diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb index 29f6013c59..5518a24160 100644 --- a/lib/rubygems/commands/uninstall_command.rb +++ b/lib/rubygems/commands/uninstall_command.rb @@ -79,7 +79,7 @@ class Gem::Commands::UninstallCommand < Gem::Command add_option("--vendor", "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 raise Gem::OptionParser::InvalidOption.new "your platform is not supported" end diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb index b1f939b0bc..e48e36823c 100644 --- a/lib/rubygems/commands/unpack_command.rb +++ b/lib/rubygems/commands/unpack_command.rb @@ -28,7 +28,7 @@ class Gem::Commands::UnpackCommand < Gem::Command options[:target] = value end - add_option("--spec", "unpack the gem specification") do |value, options| + add_option("--spec", "unpack the gem specification") do |_value, options| options[:spec] = true end diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index 5c90981645..6d2a42162e 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -300,7 +300,7 @@ command to remove old versions. def which_to_update(highest_installed_gems, gem_names) result = [] - highest_installed_gems.each do |l_name, l_spec| + highest_installed_gems.each do |_l_name, l_spec| next if !gem_names.empty? && gem_names.none? {|name| name == l_spec.name } diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb index d4078aaf5b..959365e2b1 100644 --- a/lib/rubygems/gemcutter_utilities.rb +++ b/lib/rubygems/gemcutter_utilities.rb @@ -137,7 +137,7 @@ module Gem::GemcutterUtilities request.body = URI.encode_www_form({ :api_key => api_key }.merge(update_scope_params)) end - with_response response do |resp| + with_response response do |_resp| say "Added #{scope} scope to the existing API key" end end diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb index d47701de10..f369183c64 100644 --- a/lib/rubygems/install_update_options.rb +++ b/lib/rubygems/install_update_options.rb @@ -49,7 +49,7 @@ module Gem::InstallUpdateOptions add_option(:"Install/Update", "--vendor", "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 raise Gem::OptionParser::InvalidOption.new "your platform is not supported" end @@ -59,7 +59,7 @@ module Gem::InstallUpdateOptions end add_option(:"Install/Update", "-N", "--no-document", - "Disable documentation generation") do |value, options| + "Disable documentation generation") do |_value, options| options[:document] = [] end @@ -103,21 +103,21 @@ module Gem::InstallUpdateOptions add_option(:"Install/Update", "--development", "Install additional development", - "dependencies") do |value, options| + "dependencies") do |_value, options| options[:development] = true options[:dev_shallow] = true end add_option(:"Install/Update", "--development-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[:dev_shallow] = false end add_option(:"Install/Update", "--conservative", "Don't attempt to upgrade gems already", - "meeting version requirement") do |value, options| + "meeting version requirement") do |_value, options| options[:conservative] = true options[:minimal_deps] = true end @@ -135,7 +135,7 @@ module Gem::InstallUpdateOptions add_option(:"Install/Update", "-g", "--file [FILE]", "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| File.exist? file end unless v @@ -153,29 +153,29 @@ module Gem::InstallUpdateOptions add_option(:"Install/Update", "--without GROUPS", Array, "Omit the named groups (comma separated)", "when installing from a gem dependencies", - "file") do |v,o| + "file") do |v,_o| options[:without_groups].concat v.map {|without| without.intern } end add_option(:"Install/Update", "--default", "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 end add_option(:"Install/Update", "--explain", "Rather than install the gems, indicate which would", - "be installed") do |v,o| + "be installed") do |v,_o| options[:explain] = v end 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 end 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 end end diff --git a/lib/rubygems/local_remote_options.rb b/lib/rubygems/local_remote_options.rb index b2c2dea905..2717612a7c 100644 --- a/lib/rubygems/local_remote_options.rb +++ b/lib/rubygems/local_remote_options.rb @@ -39,17 +39,17 @@ module Gem::LocalRemoteOptions def add_local_remote_options 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 end 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 end 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 end @@ -67,7 +67,7 @@ module Gem::LocalRemoteOptions add_option(:"Local/Remote", "-B", "--bulk-threshold COUNT", "Threshold for switching to bulk", "synchronization (default #{Gem.configuration.bulk_threshold})") do - |value, options| + |value, _options| Gem.configuration.bulk_threshold = value.to_i end end @@ -77,7 +77,7 @@ module Gem::LocalRemoteOptions def add_clear_sources_option add_option(:"Local/Remote", "--clear-sources", - "Clear the gem sources") do |value, options| + "Clear the gem sources") do |_value, options| Gem.sources = nil options[:sources_cleared] = true end @@ -119,7 +119,7 @@ module Gem::LocalRemoteOptions def add_update_sources_option 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 end end diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index 050ffbfe77..c2c7480351 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -691,7 +691,7 @@ EOM "package content (data.tar.gz) is missing", @gem 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(', ')})" end end diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb index c72955f83b..f4104a6be1 100644 --- a/lib/rubygems/query_utils.rb +++ b/lib/rubygems/query_utils.rb @@ -17,7 +17,7 @@ module Gem::QueryUtils options[:installed] = value end - add_option("-I", "Equivalent to --no-installed") do |value, options| + add_option("-I", "Equivalent to --no-installed") do |_value, options| options[:installed] = false end @@ -197,7 +197,7 @@ module Gem::QueryUtils end 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 platforms = Hash.new {|h,version| h[version] = [] } diff --git a/lib/rubygems/security/policy.rb b/lib/rubygems/security/policy.rb index 959880ddc1..913436fff7 100644 --- a/lib/rubygems/security/policy.rb +++ b/lib/rubygems/security/policy.rb @@ -225,7 +225,7 @@ class Gem::Security::Policy trust_dir = opt[:trust_dir] 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 end diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb index ec1a594238..51d6d243a8 100644 --- a/lib/rubygems/source/local.rb +++ b/lib/rubygems/source/local.rb @@ -113,7 +113,7 @@ class Gem::Source::Local < Gem::Source def download(spec, cache_dir = nil) # :nodoc: load_specs :complete - @specs.each do |name, data| + @specs.each do |_name, data| return data[0] if data[1].spec == spec end diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index 69050797c3..0a34b28f0d 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -193,10 +193,10 @@ class Gem::SpecFetcher matches = if matches.empty? && type != :prerelease suggest_gems_from_name gem_name, :prerelease else - matches.uniq.sort_by {|name, dist| dist } + matches.uniq.sort_by {|_name, dist| dist } end - matches.map {|name, dist| name }.uniq.first(num_results) + matches.map {|name, _dist| name }.uniq.first(num_results) end ## diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 9136000567..f620261a12 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -175,7 +175,7 @@ class Gem::Specification < Gem::BasicSpecification end @@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| @@default_value[k].nil? end @@ -1072,7 +1072,7 @@ class Gem::Specification < Gem::BasicSpecification def self.find_in_unresolved_tree(path) 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) :next else @@ -2376,7 +2376,7 @@ class Gem::Specification < Gem::BasicSpecification # True if this gem has the same attributes as +other+. 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 private :same_attributes? diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb index 5883ed1c41..1c82f76047 100644 --- a/lib/rubygems/uninstaller.rb +++ b/lib/rubygems/uninstaller.rb @@ -341,7 +341,7 @@ class Gem::Uninstaller s.name == spec.name && s.full_name != spec.full_name 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 } msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}" end diff --git a/lib/rubygems/validator.rb b/lib/rubygems/validator.rb index 1609924607..b42a176ae3 100644 --- a/lib/rubygems/validator.rb +++ b/lib/rubygems/validator.rb @@ -87,7 +87,7 @@ class Gem::Validator 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 good, gone = package.contents.partition do |file_name| diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index eaa9fbad11..d2db0f768f 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -1740,7 +1740,7 @@ class TestGem < Gem::TestCase # # FIXME what does this solve precisely? -ebh # - @additional.each do |dir| + @additional.each do |_dir| Gem.ensure_gem_subdirectories @gemhome end end diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index 99fa89364d..414c7858c6 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -15,7 +15,7 @@ class TestGemCommand < Gem::TestCase @common_options = Gem::Command.common_options.dup Gem::Command.common_options.clear Gem::Command.common_options << [ - ["-x", "--exe", "Execute"], lambda do |*a| + ["-x", "--exe", "Execute"], lambda do |*_a| @xopt = true end ] @@ -151,7 +151,7 @@ class TestGemCommand < Gem::TestCase done = false 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 done = true end @@ -174,7 +174,7 @@ class TestGemCommand < Gem::TestCase end 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 end @@ -202,13 +202,13 @@ class TestGemCommand < Gem::TestCase end 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 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 end - @cmd.add_option("--silent", "Silence RubyGems output") do |value, options| + @cmd.add_option("--silent", "Silence RubyGems output") do |_value, options| options[:silent] = true end assert @cmd.handles?(["-x"]) @@ -236,7 +236,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg def initialize 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 end @@ -265,7 +265,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur def initialize 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 end @@ -294,7 +294,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg def initialize 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 end @@ -323,7 +323,7 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur def initialize 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 end diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb index b84bc4f7ef..6d7536032e 100644 --- a/test/rubygems/test_gem_commands_help_command.rb +++ b/test/rubygems/test_gem_commands_help_command.rb @@ -63,7 +63,7 @@ class TestGemCommandsHelpCommand < Gem::TestCase def test_gem_help_commands_omits_deprecated_commands 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.each do |cmd| refute_match(/\A\s+#{cmd}\s+\S+\z/, out) diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb index 2b0b874b2d..bb176b75c4 100644 --- a/test/rubygems/test_gem_dependency_installer.rb +++ b/test/rubygems/test_gem_dependency_installer.rb @@ -561,7 +561,7 @@ class TestGemDependencyInstaller < Gem::TestCase done_installing_called = false - Gem.done_installing do |dep_installer, specs| + Gem.done_installing do |dep_installer, _specs| done_installing_called = true assert_empty dep_installer.document end diff --git a/test/rubygems/test_gem_ext_rake_builder.rb b/test/rubygems/test_gem_ext_rake_builder.rb index 3ed818a7f8..e833cb43aa 100644 --- a/test/rubygems/test_gem_ext_rake_builder.rb +++ b/test/rubygems/test_gem_ext_rake_builder.rb @@ -91,7 +91,7 @@ class TestGemExtRakeBuilder < Gem::TestCase create_temp_mkrf_file("task :default do abort 'fail' end") output = [] - build_rake_in(false) do |rake| + build_rake_in(false) do |_rake| error = assert_raise Gem::InstallError do Gem::Ext::RakeBuilder.build "mkrf_conf.rb", @dest_path, output, [], nil, @ext end diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index cc77052f5a..631d6a09ea 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -1025,7 +1025,7 @@ gem 'other', version @gem = setup_base_gem # 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| f.puts "require 'code'" end diff --git a/test/rubygems/test_gem_package_tar_reader.rb b/test/rubygems/test_gem_package_tar_reader.rb index 62e60489a6..fa2a3c4745 100644 --- a/test/rubygems/test_gem_package_tar_reader.rb +++ b/test/rubygems/test_gem_package_tar_reader.rb @@ -77,7 +77,7 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase io = TempIO.new tar 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" end diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb index 098df5a538..4e29b394a6 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -1142,7 +1142,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== :SSLVerifyClient => nil, :SSLCertName => nil, }.merge(config)) - server.mount_proc("/yaml") do |req, res| + server.mount_proc("/yaml") do |_req, res| res.body = "--- true\n" end server.mount_proc("/insecure_redirect") do |req, res| @@ -1179,7 +1179,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== :Logger => 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| if req["X-Captain"] res.body = req["X-Captain"] @@ -1193,7 +1193,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== res["Content-Type"] = "text/html" end end - s.mount_proc("/yaml.Z") do |req, res| + s.mount_proc("/yaml.Z") do |_req, res| if @enable_zip res.body = Zlib::Deflate.deflate(data) res["Content-Type"] = "text/plain" diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb index aba9dc5447..09ab02852c 100644 --- a/test/rubygems/test_gem_request.rb +++ b/test/rubygems/test_gem_request.rb @@ -248,7 +248,7 @@ class TestGemRequest < Gem::TestCase def test_fetch_head 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.fetch end diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb index 0a27400ade..1e80028ccc 100644 --- a/test/rubygems/test_gem_request_set.rb +++ b/test/rubygems/test_gem_request_set.rb @@ -45,7 +45,7 @@ class TestGemRequestSet < Gem::TestCase done_installing_ran = false - Gem.done_installing do |installer, specs| + Gem.done_installing do |_installer, _specs| done_installing_ran = true end @@ -56,7 +56,7 @@ class TestGemRequestSet < Gem::TestCase io.puts 'gem "a"' 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 end @@ -114,7 +114,7 @@ Gems to install: :install_dir => "#{@gemhome}2", } - rs.install_from_gemdeps options do |req, installer| + rs.install_from_gemdeps options do |req, _installer| installed << req.full_name end @@ -172,7 +172,7 @@ DEPENDENCIES io.puts 'gem "b"' 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 end @@ -226,7 +226,7 @@ end io.puts("gemspec") end - rs.install_from_gemdeps :gemdeps => "Gemfile" do |req, installer| + rs.install_from_gemdeps :gemdeps => "Gemfile" do |req, _installer| installed << req.full_name end @@ -251,7 +251,7 @@ ruby "0" 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 end end diff --git a/test/rubygems/test_gem_silent_ui.rb b/test/rubygems/test_gem_silent_ui.rb index c5d2a35c34..41373802d2 100644 --- a/test/rubygems/test_gem_silent_ui.rb +++ b/test/rubygems/test_gem_silent_ui.rb @@ -115,7 +115,7 @@ class TestGemSilentUI < Gem::TestCase end 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 end end diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 56ca7acaf2..78cac6dbca 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -2930,7 +2930,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use: { b: Gem::Dependency.new("x","1") } end - specification.define_singleton_method(:find_all_by_name) do |dep_name| + specification.define_singleton_method(:find_all_by_name) do |_dep_name| [] end @@ -2957,7 +2957,7 @@ Please report a bug if this causes problems. { b: Gem::Dependency.new("x","1") } 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("2") }, diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index 73ae0caf7d..af07364bb5 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -425,7 +425,7 @@ class TestGemRequire < Gem::TestCase 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" end