[前][次][番号順一覧][スレッド一覧]

ruby-changes:60572

From: David <ko1@a...>
Date: Mon, 30 Mar 2020 13:00:59 +0900 (JST)
Subject: [ruby-changes:60572] 061add792e (master): [rubygems/rubygems] Enable `Style/ExtraSpacing` and auto-correct

https://git.ruby-lang.org/ruby.git/commit/?id=061add792e

From 061add792e658878c839887682716737d9f6d677 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Fri, 3 May 2019 19:56:58 +0200
Subject: [rubygems/rubygems] Enable `Style/ExtraSpacing` and auto-correct

https://github.com/rubygems/rubygems/commit/6fa0b1b679

diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index d4ff4a2..0e83f1b 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -115,7 +115,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L115
   # The default directory for binaries
 
   def self.default_bindir
-    if defined? RUBY_FRAMEWORK_VERSION  # mac framework support
+    if defined? RUBY_FRAMEWORK_VERSION # mac framework support
       '/usr/bin'
     else # generic install
       RbConfig::CONFIG['bindir']
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index dbf787c..65c2f30 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -30,7 +30,7 @@ module Gem::InstallUpdateOptions https://github.com/ruby/ruby/blob/trunk/lib/rubygems/install_update_options.rb#L30
       options[:bin_dir] = File.expand_path(value)
     end
 
-    add_option(:"Install/Update",       '--document [TYPES]', Array,
+    add_option(:"Install/Update", '--document [TYPES]', Array,
                'Generate documentation for installed gems',
                'List the documentation types you wish to',
                'generate.  For example: rdoc,ri') do |value, options|
@@ -88,7 +88,7 @@ module Gem::InstallUpdateOptions https://github.com/ruby/ruby/blob/trunk/lib/rubygems/install_update_options.rb#L88
       options[:ignore_dependencies] = value
     end
 
-    add_option(:"Install/Update",       '--[no-]format-executable',
+    add_option(:"Install/Update", '--[no-]format-executable',
                'Make installed executable names match Ruby.',
                'If Ruby is ruby18, foo_exec will be',
                'foo_exec18') do |value, options|
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 521c552..1692eb7 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -56,7 +56,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L56
     when String then
       arch = arch.split '-'
 
-      if arch.length > 2 and arch.last !~ /\d/  # reassemble x86-linux-gnu
+      if arch.length > 2 and arch.last !~ /\d/ # reassemble x86-linux-gnu
         extra = arch.pop
         arch.last << "-#{extra}"
       end
@@ -68,7 +68,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L68
              else cpu
              end
 
-      if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/  # for command-line
+      if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ # for command-line
         @os, @version = arch
         return
       end
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index b37ebc1..e260926 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -118,7 +118,7 @@ class Gem::RemoteFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/remote_fetcher.rb#L118
 
   def download(spec, source_uri, install_dir = Gem.dir)
     cache_dir =
-      if Dir.pwd == install_dir  # see fetch_command
+      if Dir.pwd == install_dir # see fetch_command
         install_dir
       elsif File.writable? install_dir
         File.join install_dir, "cache"
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 3a2a609..6c37555 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -720,7 +720,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L720
   # Deprecated: You must now specify the executable name to  Gem.bin_path.
 
   attr_writer :default_executable
-  deprecate :default_executable=, :none,       2018, 12
+  deprecate :default_executable=, :none, 2018, 12
 
   ##
   # Allows deinstallation of gems with legacy platforms.
@@ -733,7 +733,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L733
   # Formerly used to set rubyforge project.
 
   attr_writer :rubyforge_project
-  deprecate :rubyforge_project=, :none,       2019, 12
+  deprecate :rubyforge_project=, :none, 2019, 12
 
   ##
   # The Gem::Specification version of this gemspec.
@@ -1725,7 +1725,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1725
     end
     result
   end
-  deprecate :default_executable,  :none,       2018, 12
+  deprecate :default_executable, :none, 2018, 12
 
   ##
   # The default value for specification attribute +name+
@@ -1928,7 +1928,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1928
   def has_rdoc # :nodoc:
     true
   end
-  deprecate :has_rdoc,            :none,       2018, 12
+  deprecate :has_rdoc, :none, 2018, 12
 
   ##
   # Deprecated and ignored.
@@ -1938,10 +1938,10 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1938
   def has_rdoc=(ignored) # :nodoc:
     @has_rdoc = true
   end
-  deprecate :has_rdoc=,           :none,       2018, 12
+  deprecate :has_rdoc=, :none, 2018, 12
 
   alias :has_rdoc? :has_rdoc # :nodoc:
-  deprecate :has_rdoc?,           :none,       2018, 12
+  deprecate :has_rdoc?, :none, 2018, 12
 
   ##
   # True if this gem has files in test_files
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index a50fafb..d9f415d 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -8,7 +8,7 @@ class Gem::SpecificationPolicy https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification_policy.rb#L8
 
   SPECIAL_CHARACTERS = /\A[#{Regexp.escape('.-_')}]+/.freeze # :nodoc:
 
-  VALID_URI_PATTERN = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}.freeze  # :nodoc:
+  VALID_URI_PATTERN = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}.freeze # :nodoc:
 
   METADATA_LINK_KEYS = %w[
     bug_tracker_uri
@@ -281,7 +281,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification_policy.rb#L281
     platform = @specification.platform
 
     case platform
-    when Gem::Platform, Gem::Platform::RUBY  # ok
+    when Gem::Platform, Gem::Platform::RUBY # ok
     else
       error "invalid platform #{platform.inspect}, see Gem::Platform"
     end
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 27b7022..ba9b643 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1024,7 +1024,7 @@ Also, a list: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L1024
 
     spec_fetcher = Gem::SpecFetcher.fetcher
 
-    prerelease, all = all_specs.partition { |spec| spec.version.prerelease?  }
+    prerelease, all = all_specs.partition { |spec| spec.version.prerelease? }
     latest = Gem::Specification._latest_specs all_specs
 
     spec_fetcher.specs[@uri] = []
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb
index 6ae3c0e..0edf3d6 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/lib/rubygems/test_utilities.rb
@@ -134,7 +134,7 @@ class Gem::FakeFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_utilities.rb#L134
 
   def download(spec, source_uri, install_dir = Gem.dir)
     name = File.basename spec.cache_file
-    path = if Dir.pwd == install_dir  # see fetch_command
+    path = if Dir.pwd == install_dir # see fetch_command
              install_dir
            else
              File.join install_dir, "cache"
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index b1faedc..d216647 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -187,7 +187,7 @@ class Gem::Version https://github.com/ruby/ruby/blob/trunk/lib/rubygems/version.rb#L187
   #   ver3 = Version.create(nil)        # -> nil
 
   def self.create(input)
-    if self === input  # check yourself before you wreck yourself
+    if self === input # check yourself before you wreck yourself
       input
     elsif input.nil?
       nil
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 0c7e0f7..1f5e0e6 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -649,7 +649,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L649
     assert_directory_exists util_cache_dir
   end
 
-  unless win_platform? || Process.uid.zero?  # only for FS that support write protection
+  unless win_platform? || Process.uid.zero? # only for FS that support write protection
     def test_self_ensure_gem_directories_write_protected
       gemdir = File.join @tempdir, "egd"
       FileUtils.rm_r gemdir rescue nil
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index 7679260..4a0244c 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -23,11 +23,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L23
     FileUtils.mkdir_p 'bin'
     FileUtils.mkdir_p 'lib/rubygems/ssl_certs/rubygems.org'
 
-    File.open 'bin/gem',                   'w' do
+    File.open 'bin/gem', 'w' do
       |io| io.puts '# gem'
     end
 
-    File.open 'lib/rubygems.rb',           'w' do |io|
+    File.open 'lib/rubygems.rb', 'w' do |io|
       io.puts '# rub (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]