[rubygems/rubygems] util/rubocop -A --only Style/Alias

https://github.com/rubygems/rubygems/commit/fba6e94de9
This commit is contained in:
Hiroshi SHIBATA 2023-03-16 12:55:30 +09:00
parent f4d1f660d0
commit 83f9aa8f02
19 changed files with 26 additions and 26 deletions

View File

@ -9,7 +9,7 @@ class Gem::Commands::QueryCommand < Gem::Command
include Gem::QueryUtils include Gem::QueryUtils
alias warning_without_suggested_alternatives deprecation_warning alias_method :warning_without_suggested_alternatives, :deprecation_warning
def deprecation_warning def deprecation_warning
warning_without_suggested_alternatives warning_without_suggested_alternatives

View File

@ -13,7 +13,7 @@ module Kernel
# Make sure we have a reference to Ruby's original Kernel#require # Make sure we have a reference to Ruby's original Kernel#require
unless defined?(gem_original_require) unless defined?(gem_original_require)
# :stopdoc: # :stopdoc:
alias gem_original_require require alias_method :gem_original_require, :require
private :gem_original_require private :gem_original_require
# :startdoc: # :startdoc:
end end

View File

@ -204,7 +204,7 @@ class Gem::Dependency
requirement.satisfied_by? version requirement.satisfied_by? version
end end
alias === =~ alias_method :===, :=~
## ##
# :call-seq: # :call-seq:

View File

@ -174,6 +174,6 @@ module Gem
## ##
# The "exception" alias allows you to call raise on a SourceFetchProblem. # The "exception" alias allows you to call raise on a SourceFetchProblem.
alias exception error alias_method :exception, :error
end end
end end

View File

@ -222,7 +222,7 @@ class Gem::SystemExitException < SystemExit
## ##
# The exit code for the process # The exit code for the process
alias exit_code status alias_method :exit_code, :status
## ##
# Creates a new SystemExitException with the given +exit_code+ # Creates a new SystemExitException with the given +exit_code+

View File

@ -86,7 +86,7 @@ class Gem::NameTuple
"#<Gem::NameTuple #{@name}, #{@version}, #{@platform}>" "#<Gem::NameTuple #{@name}, #{@version}, #{@platform}>"
end end
alias to_s inspect # :nodoc: alias_method :to_s, :inspect # :nodoc:
def <=>(other) def <=>(other)
[@name, @version, Gem::Platform.sort_priority(@platform)] <=> [@name, @version, Gem::Platform.sort_priority(@platform)] <=>

View File

@ -62,7 +62,7 @@ class Gem::Package::TarReader
end end
end end
alias each_entry each alias_method :each_entry, :each
## ##
# NOTE: Do not call #rewind during #each # NOTE: Do not call #rewind during #each

View File

@ -151,7 +151,7 @@ class Gem::Package::TarReader::Entry
@header.size @header.size
end end
alias length size alias_method :length, :size
## ##
# Reads +len+ bytes from the tar file entry, or the rest of the entry if # Reads +len+ bytes from the tar file entry, or the rest of the entry if

View File

@ -141,7 +141,7 @@ class Gem::Platform
self.class === other && to_a == other.to_a self.class === other && to_a == other.to_a
end end
alias :eql? :== alias_method :eql?, :==
def hash # :nodoc: def hash # :nodoc:
to_a.hash to_a.hash

View File

@ -233,7 +233,7 @@ class Gem::RemoteFetcher
end end
end end
alias :fetch_https :fetch_http alias_method :fetch_https, :fetch_http
## ##
# Downloads +uri+ and returns it as a String. # Downloads +uri+ and returns it as a String.

View File

@ -767,7 +767,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
# Block form for restricting gems to a particular set of platforms. See # Block form for restricting gems to a particular set of platforms. See
# #platform. # #platform.
alias :platforms :platform alias_method :platforms, :platform
## ##
# :category: Gem Dependencies DSL # :category: Gem Dependencies DSL

View File

@ -48,7 +48,7 @@ class Gem::RequestSet::Lockfile::Tokenizer
def next_token def next_token
@tokens.shift @tokens.shift
end end
alias :shift :next_token alias_method :shift, :next_token
def peek def peek
@tokens.first || EOF @tokens.first || EOF

View File

@ -244,8 +244,8 @@ class Gem::Requirement
requirements.all? {|op, rv| OPS[op].call version, rv } requirements.all? {|op, rv| OPS[op].call version, rv }
end end
alias :=== :satisfied_by? alias_method :===, :satisfied_by?
alias :=~ :satisfied_by? alias_method :=~, :satisfied_by?
## ##
# True if the requirement will not always match the latest version. # True if the requirement will not always match the latest version.

View File

@ -287,5 +287,5 @@ class Gem::Security::Policy
true true
end end
alias to_s name # :nodoc: alias_method :to_s, :name # :nodoc:
end end

View File

@ -735,7 +735,7 @@ class Gem::Specification < Gem::BasicSpecification
attr_accessor :activated attr_accessor :activated
alias :activated? :activated alias_method :activated?, :activated
## ##
# Autorequire was used by old RubyGems to automatically require a file. # Autorequire was used by old RubyGems to automatically require a file.
@ -1546,7 +1546,7 @@ class Gem::Specification < Gem::BasicSpecification
private :add_dependency_with_type private :add_dependency_with_type
alias add_dependency add_runtime_dependency alias_method :add_dependency, :add_runtime_dependency
## ##
# Adds this spec's require paths to LOAD_PATH, in the proper location. # Adds this spec's require paths to LOAD_PATH, in the proper location.
@ -1991,7 +1991,7 @@ class Gem::Specification < Gem::BasicSpecification
end end
rubygems_deprecate :has_rdoc= rubygems_deprecate :has_rdoc=
alias :has_rdoc? :has_rdoc # :nodoc: alias_method :has_rdoc?, :has_rdoc # :nodoc:
rubygems_deprecate :has_rdoc? rubygems_deprecate :has_rdoc?
## ##
@ -2002,7 +2002,7 @@ class Gem::Specification < Gem::BasicSpecification
end end
# :stopdoc: # :stopdoc:
alias has_test_suite? has_unit_tests? alias_method :has_test_suite?, :has_unit_tests?
# :startdoc: # :startdoc:
def hash # :nodoc: def hash # :nodoc:

View File

@ -165,7 +165,7 @@ class Gem::Version
@version.dup @version.dup
end end
alias to_s version alias_method :to_s, :version
## ##
# True if the +version+ string matches RubyGems' requirements. # True if the +version+ string matches RubyGems' requirements.

View File

@ -153,7 +153,7 @@ install:
def test_build_extensions_install_ext_only def test_build_extensions_install_ext_only
class << Gem class << Gem
alias orig_install_extension_in_lib install_extension_in_lib alias_method :orig_install_extension_in_lib, :install_extension_in_lib
remove_method :install_extension_in_lib remove_method :install_extension_in_lib
@ -199,7 +199,7 @@ install:
class << Gem class << Gem
remove_method :install_extension_in_lib remove_method :install_extension_in_lib
alias install_extension_in_lib orig_install_extension_in_lib alias_method :install_extension_in_lib, :orig_install_extension_in_lib
end end
end end

View File

@ -1704,7 +1704,7 @@ dependencies: []
RbConfig::CONFIG["ENABLE_SHARED"], "no" RbConfig::CONFIG["ENABLE_SHARED"], "no"
class << Gem class << Gem
alias orig_default_ext_dir_for default_ext_dir_for alias_method :orig_default_ext_dir_for, :default_ext_dir_for
remove_method :default_ext_dir_for remove_method :default_ext_dir_for
@ -1726,7 +1726,7 @@ dependencies: []
class << Gem class << Gem
remove_method :default_ext_dir_for remove_method :default_ext_dir_for
alias default_ext_dir_for orig_default_ext_dir_for alias_method :default_ext_dir_for, :orig_default_ext_dir_for
end end
end end

View File

@ -541,7 +541,7 @@ class TestGemRequire < Gem::TestCase
def test_try_activate_error_unlocks_require_monitor def test_try_activate_error_unlocks_require_monitor
silence_warnings do silence_warnings do
class << ::Gem class << ::Gem
alias old_try_activate try_activate alias_method :old_try_activate, :try_activate
def try_activate(*); raise "raised from try_activate"; end def try_activate(*); raise "raised from try_activate"; end
end end
end end
@ -553,7 +553,7 @@ class TestGemRequire < Gem::TestCase
ensure ensure
silence_warnings do silence_warnings do
class << ::Gem class << ::Gem
alias try_activate old_try_activate alias_method :try_activate, :old_try_activate
end end
end end
Kernel::RUBYGEMS_ACTIVATION_MONITOR.exit Kernel::RUBYGEMS_ACTIVATION_MONITOR.exit