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