[rubygems/rubygems] auto-correct Style/YodaCondition

https://github.com/rubygems/rubygems/commit/6d9e8025dc
This commit is contained in:
Hiroshi SHIBATA 2023-06-14 16:51:53 +09:00
parent 503b9bf1d4
commit 827d66266b
9 changed files with 9 additions and 9 deletions

View File

@ -12,7 +12,7 @@ module Bundler
def self.platforms_match?(gemspec_platform, local_platform) def self.platforms_match?(gemspec_platform, local_platform)
return true if gemspec_platform.nil? return true if gemspec_platform.nil?
return true if Gem::Platform::RUBY == gemspec_platform return true if gemspec_platform == Gem::Platform::RUBY
return true if local_platform == gemspec_platform return true if local_platform == gemspec_platform
gemspec_platform = Gem::Platform.new(gemspec_platform) gemspec_platform = Gem::Platform.new(gemspec_platform)
return true if gemspec_platform === local_platform return true if gemspec_platform === local_platform

View File

@ -76,7 +76,7 @@ class Gem::BasicSpecification
elsif missing_extensions? elsif missing_extensions?
@ignored = true @ignored = true
if Gem::Platform::RUBY == platform || Gem::Platform.local === platform if platform == Gem::Platform::RUBY || Gem::Platform.local === platform
warn "Ignoring #{full_name} because its extensions are not built. " \ warn "Ignoring #{full_name} because its extensions are not built. " \
"Try: gem pristine #{name} --version #{version}" "Try: gem pristine #{name} --version #{version}"
end end

View File

@ -121,7 +121,7 @@ extensions will be restored.
end.flatten end.flatten
end end
specs = specs.select {|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY } specs = specs.select {|spec| spec.platform == RUBY_ENGINE || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY }
if specs.to_a.empty? if specs.to_a.empty?
raise Gem::Exception, raise Gem::Exception,

View File

@ -155,7 +155,7 @@ class Gem::Package
Gem::Package::FileSource.new gem Gem::Package::FileSource.new gem
end end
return super unless Gem::Package == self return super unless self == Gem::Package
return super unless gem.present? return super unless gem.present?
return super unless gem.start return super unless gem.start

View File

@ -102,7 +102,7 @@ class Gem::Package::TarHeader
def self.from(stream) def self.from(stream)
header = stream.read 512 header = stream.read 512
empty = (EMPTY_HEADER == header) empty = (header == EMPTY_HEADER)
fields = header.unpack UNPACK_FORMAT fields = header.unpack UNPACK_FORMAT

View File

@ -790,7 +790,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
return true if @installing return true if @installing
unless RUBY_VERSION == version unless version == RUBY_VERSION
message = "Your Ruby version is #{RUBY_VERSION}, " \ message = "Your Ruby version is #{RUBY_VERSION}, " \
"but your #{gem_deps_file} requires #{version}" "but your #{gem_deps_file} requires #{version}"

View File

@ -109,7 +109,7 @@ class Gem::RequestSet::Lockfile
requests.sort_by(&:name).each do |request| requests.sort_by(&:name).each do |request|
next if request.spec.name == "bundler" next if request.spec.name == "bundler"
platform = "-#{request.spec.platform}" unless platform = "-#{request.spec.platform}" unless
Gem::Platform::RUBY == request.spec.platform request.spec.platform == Gem::Platform::RUBY
out << " #{request.name} (#{request.version}#{platform})" out << " #{request.name} (#{request.version}#{platform})"

View File

@ -76,7 +76,7 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
q.breakable q.breakable
q.text full_name q.text full_name
unless Gem::Platform::RUBY == @platform unless @platform == Gem::Platform::RUBY
q.breakable q.breakable
q.text @platform.to_s q.text @platform.to_s
end end

View File

@ -201,7 +201,7 @@ class Gem::Version
@@release = {} @@release = {}
def self.new(version) # :nodoc: def self.new(version) # :nodoc:
return super unless Gem::Version == self return super unless self == Gem::Version
@@all[version] ||= super @@all[version] ||= super
end end