diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-03-16 10:46:45 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2023-03-17 18:50:55 +0900 |
commit | 05208c3875a12a188e14328ffbd5b2eb21824f24 () | |
tree | 659dc072793f13810edd33ab818b2eeb6d994e77 /lib | |
parent | 7ab4ede4f5ec23d9eac6868176d99ad63df46978 (diff) |
[rubygems/rubygems] util/rubocop -A --only Lint/UnusedBlockArgument
https://.com/rubygems/rubygems/commit/d8efd919db
-rw-r--r-- | lib/rubygems/available_set.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/command.rb | 8 | ||||
-rw-r--r-- | lib/rubygems/commands/build_command.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/commands/cleanup_command.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/commands/exec_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/specification_command.rb | 8 | ||||
-rw-r--r-- | lib/rubygems/commands/uninstall_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/unpack_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/update_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/gemcutter_utilities.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/install_update_options.rb | 22 | ||||
-rw-r--r-- | lib/rubygems/local_remote_options.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/package.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/query_utils.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/security/policy.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/source/local.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/spec_fetcher.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 6 | ||||
-rw-r--r-- | lib/rubygems/uninstaller.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/validator.rb | 2 |
20 files changed, 47 insertions, 47 deletions
@@ -146,7 +146,7 @@ class Gem::AvailableSet end def remove_installed!(dep) - @set.reject! do |t| # already locally installed Gem::Specification.any? do |installed_spec| dep.name == installed_spec.name && @@ -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| options[:help] = true end add_common_option("-V", "--[no-]verbose", - "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| Gem.configuration.verbose = false end add_common_option("--silent", - "Silence RubyGems output") do |value, options| options[:silent] = true end @@ -11,11 +11,11 @@ class Gem::Commands::BuildCommand < Gem::Command add_platform_option - 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| options[:strict] = true end @@ -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| options[:dryrun] = true end add_option(:Deprecated, "--dryrun", - "Do not uninstall gems") do |value, options| options[:dryrun] = true end deprecate_option("--dryrun", extra_msg: "Use --dry-run instead") @@ -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| options[:conservative] = true end end @@ -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| options[:all] = true end - add_option("--ruby", "Output ruby format") do |value, options| options[:format] = :ruby end - add_option("--yaml", "Output YAML format") do |value, options| options[:format] = :yaml end - add_option("--marshal", "Output Marshal format") do |value, options| options[:format] = :marshal end @@ -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| unless Gem.vendor_dir raise Gem::OptionParser::InvalidOption.new "your platform is not supported" end @@ -28,7 +28,7 @@ class Gem::Commands::UnpackCommand < Gem::Command options[:target] = value end - add_option("--spec", "unpack the gem specification") do |value, options| options[:spec] = true end @@ -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| next if !gem_names.empty? && gem_names.none? {|name| name == l_spec.name } @@ -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| say "Added #{scope} scope to the existing API key" end end @@ -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| 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| options[:document] = [] end @@ -103,21 +103,21 @@ module Gem::InstallUpdateOptions add_option(:"Install/Update", "--development", "Install additional development", - "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| 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| 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| 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| 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| options[:install_as_default] = v end add_option(:"Install/Update", "--explain", "Rather than install the gems, indicate which would", - "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| options[:lock] = v end add_option(:"Install/Update", "--[no-]suggestions", - "Suggest alternates when gems are not found") do |v,o| options[:suggest_alternate] = v end end @@ -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| options[:domain] = :local end add_option(:"Local/Remote", "-r", "--remote", - "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| 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| 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| 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| Gem.configuration.update_sources = value end end @@ -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? raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})" end end @@ -17,7 +17,7 @@ module Gem::QueryUtils options[:installed] = value end - 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| matching_tuples = matching_tuples.sort_by {|n,_| n.version }.reverse platforms = Hash.new {|h,version| h[version] = [] } @@ -225,7 +225,7 @@ class Gem::Security::Policy trust_dir = opt[:trust_dir] time = Time.now - _, signer_digests = digests.find do |algorithm, file_digests| file_digests.values.first.name == Gem::Security::DIGEST_NAME end @@ -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| return data[0] if data[1].spec == spec end @@ -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 } end - matches.map {|name, dist| name }.uniq.first(num_results) end ## @@ -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 @@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| 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) } end private :same_attributes? @@ -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| unless siblings.any? {|s| s.satisfies_requirement? dep } msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}" end @@ -87,7 +87,7 @@ class Gem::Validator good, gone, unreadable = nil, nil, nil, nil - File.open gem_path, Gem.binary_mode do |file| package = Gem::Package.new gem_path good, gone = package.contents.partition do |file_name| |