зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] util/rubocop -A --only Style/YodaCondition
https://github.com/rubygems/rubygems/commit/3594945391
This commit is contained in:
Родитель
66bd2c1a1c
Коммит
d8c5fa963f
|
@ -454,7 +454,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
# distinction as extensions cannot be shared between the two.
|
||||
|
||||
def self.extension_api_version # :nodoc:
|
||||
if "no" == RbConfig::CONFIG["ENABLE_SHARED"]
|
||||
if RbConfig::CONFIG["ENABLE_SHARED"] == "no"
|
||||
"#{ruby_api_version}-static"
|
||||
else
|
||||
ruby_api_version
|
||||
|
@ -731,7 +731,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
|
||||
if prefix != File.expand_path(RbConfig::CONFIG["sitelibdir"]) &&
|
||||
prefix != File.expand_path(RbConfig::CONFIG["libdir"]) &&
|
||||
"lib" == File.basename(RUBYGEMS_DIR)
|
||||
File.basename(RUBYGEMS_DIR) == "lib"
|
||||
prefix
|
||||
end
|
||||
end
|
||||
|
|
|
@ -104,14 +104,14 @@ class Gem::AvailableSet
|
|||
|
||||
def to_request_set(development = :none)
|
||||
request_set = Gem::RequestSet.new
|
||||
request_set.development = :all == development
|
||||
request_set.development = development == :all
|
||||
|
||||
each_spec do |spec|
|
||||
request_set.always_install << spec
|
||||
|
||||
request_set.gem spec.name, spec.version
|
||||
request_set.import spec.development_dependencies if
|
||||
:shallow == development
|
||||
development == :shallow
|
||||
end
|
||||
|
||||
request_set
|
||||
|
|
|
@ -45,7 +45,7 @@ class Gem::Dependency
|
|||
end
|
||||
|
||||
type = Symbol === requirements.last ? requirements.pop : :runtime
|
||||
requirements = requirements.first if 1 == requirements.length # unpack
|
||||
requirements = requirements.first if requirements.length == 1 # unpack
|
||||
|
||||
unless TYPES.include? type
|
||||
raise ArgumentError, "Valid types are #{TYPES.inspect}, " +
|
||||
|
|
|
@ -111,8 +111,8 @@ class Gem::Doctor
|
|||
basename = File.basename(child, extension)
|
||||
next if installed_specs.include? basename
|
||||
next if /^rubygems-\d/ =~ basename
|
||||
next if "specifications" == sub_directory && "default" == basename
|
||||
next if "plugins" == sub_directory && Gem.plugin_suffix_regexp =~ (basename)
|
||||
next if sub_directory == "specifications" && basename == "default"
|
||||
next if sub_directory == "plugins" && Gem.plugin_suffix_regexp =~ (basename)
|
||||
|
||||
type = File.directory?(child) ? "directory" : "file"
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class Gem::RequestSet::Lockfile::Parser
|
|||
end
|
||||
|
||||
def parse_DEPENDENCIES # :nodoc:
|
||||
while !@tokens.empty? && :text == peek.type do
|
||||
while !@tokens.empty? && peek.type == :text do
|
||||
token = get :text
|
||||
|
||||
requirements = []
|
||||
|
@ -110,7 +110,7 @@ class Gem::RequestSet::Lockfile::Parser
|
|||
def parse_GEM # :nodoc:
|
||||
sources = []
|
||||
|
||||
while [:entry, "remote"] == peek.first(2) do
|
||||
while peek.first(2) == [:entry, "remote"] do
|
||||
get :entry, "remote"
|
||||
data = get(:text).value
|
||||
skip :newline
|
||||
|
@ -127,7 +127,7 @@ class Gem::RequestSet::Lockfile::Parser
|
|||
set = Gem::Resolver::LockSet.new sources
|
||||
last_specs = nil
|
||||
|
||||
while !@tokens.empty? && :text == peek.type do
|
||||
while !@tokens.empty? && peek.type == :text do
|
||||
token = get :text
|
||||
name = token.value
|
||||
column = token.column
|
||||
|
@ -199,7 +199,7 @@ class Gem::RequestSet::Lockfile::Parser
|
|||
|
||||
last_spec = nil
|
||||
|
||||
while !@tokens.empty? && :text == peek.type do
|
||||
while !@tokens.empty? && peek.type == :text do
|
||||
token = get :text
|
||||
name = token.value
|
||||
column = token.column
|
||||
|
@ -246,7 +246,7 @@ class Gem::RequestSet::Lockfile::Parser
|
|||
set = Gem::Resolver::VendorSet.new
|
||||
last_spec = nil
|
||||
|
||||
while !@tokens.empty? && :text == peek.first do
|
||||
while !@tokens.empty? && peek.first == :text do
|
||||
token = get :text
|
||||
name = token.value
|
||||
column = token.column
|
||||
|
@ -281,7 +281,7 @@ class Gem::RequestSet::Lockfile::Parser
|
|||
end
|
||||
|
||||
def parse_PLATFORMS # :nodoc:
|
||||
while !@tokens.empty? && :text == peek.first do
|
||||
while !@tokens.empty? && peek.first == :text do
|
||||
name = get(:text).value
|
||||
|
||||
@platforms << name
|
||||
|
|
|
@ -155,7 +155,7 @@ class Gem::Requirement
|
|||
# Formats this requirement for use in a Gem::RequestSet::Lockfile.
|
||||
|
||||
def for_lockfile # :nodoc:
|
||||
return if [DefaultRequirement] == @requirements
|
||||
return if @requirements == [DefaultRequirement]
|
||||
|
||||
list = requirements.sort_by do |_, version|
|
||||
version
|
||||
|
|
|
@ -105,7 +105,7 @@ class Gem::Security::Signer
|
|||
# this value is preferred, otherwise the subject is used.
|
||||
|
||||
def extract_name(cert) # :nodoc:
|
||||
subject_alt_name = cert.extensions.find {|e| "subjectAltName" == e.oid }
|
||||
subject_alt_name = cert.extensions.find {|e| e.oid == "subjectAltName" }
|
||||
|
||||
if subject_alt_name
|
||||
/\Aemail:/ =~ subject_alt_name.value # rubocop:disable Performance/StartWith
|
||||
|
|
|
@ -71,7 +71,7 @@ class Gem::Source
|
|||
# Returns a Set that can fetch specifications from this source.
|
||||
|
||||
def dependency_resolver_set # :nodoc:
|
||||
return Gem::Resolver::IndexSet.new self if "file" == uri.scheme
|
||||
return Gem::Resolver::IndexSet.new self if uri.scheme == "file"
|
||||
|
||||
fetch_uri = if uri.host == "rubygems.org"
|
||||
index_uri = uri.dup
|
||||
|
|
|
@ -30,7 +30,7 @@ class Gem::Source::Lock < Gem::Source
|
|||
end
|
||||
|
||||
def ==(other) # :nodoc:
|
||||
0 == (self <=> other)
|
||||
(self <=> other) == 0
|
||||
end
|
||||
|
||||
def hash # :nodoc:
|
||||
|
|
|
@ -1521,7 +1521,7 @@ Also, a list:
|
|||
# <tt>test/rubygems/</tt>.
|
||||
|
||||
def self.cert_path(cert_name)
|
||||
if 32 == (Time.at(2**32) rescue 32)
|
||||
if (Time.at(2**32) rescue 32) == 32
|
||||
cert_file = "#{__dir__}/#{cert_name}_cert_32.pem"
|
||||
|
||||
return cert_file if File.exist? cert_file
|
||||
|
|
|
@ -39,7 +39,7 @@ class Gem::FakeFetcher
|
|||
end
|
||||
|
||||
def find_data(path)
|
||||
return Gem.read_binary path.path if URI === path && "file" == path.scheme
|
||||
return Gem.read_binary path.path if URI === path && path.scheme == "file"
|
||||
|
||||
if URI === path && "URI::#{path.scheme.upcase}" != path.class.name
|
||||
raise ArgumentError,
|
||||
|
|
Загрузка…
Ссылка в новой задаче