summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOlle Jonsson <[email protected]>2020-04-19 22:39:42 +0200
committerHiroshi SHIBATA <[email protected]>2020-06-05 07:32:42 +0900
commit5eacf4e72cffadde3c4c2b6dada6cd5343310ae3 ()
treee5e98963fa1a51886eaea7ba84201e05ee545e83 /lib
parentf8f5e7fadf689a11a8ee28b7af4e7777e2dec1ea (diff)
Enable rubocop-performance StartWith cop
- this would keep the could-be-a-string-method matches few
Notes: Merged: https://.com/ruby/ruby/pull/3184
-rw-r--r--lib/rubygems/command.rb4
-rw-r--r--lib/rubygems/installer.rb4
-rw-r--r--lib/rubygems/platform.rb2
-rw-r--r--lib/rubygems/security/signer.rb2
-rw-r--r--lib/rubygems/specification.rb4
5 files changed, 7 insertions, 9 deletions
@@ -456,9 +456,7 @@ class Gem::Command
until extra.empty? do
ex = []
ex << extra.shift
- if (!extra.first.to_s.empty? && !extra.first.to_s.start_with?("-"))
- ex << extra.shift
- end
result << ex if handles?(ex)
end
@@ -584,9 +584,9 @@ class Gem::Installer
def shebang(bin_file_name)
ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang
path = File.join gem_dir, spec.bindir, bin_file_name
- first_line = File.open(path, "rb") {|file| file.gets}
- if /\A#!/ =~ first_line
# Preserve extra words on shebang line, like "-w". Thanks RPA.
shebang = first_line.sub(/\A\#!.*?ruby\S*((\s+\S+)+)/, "#!#{Gem.ruby}")
opts = $1
@@ -150,7 +150,7 @@ class Gem::Platform
# cpu
([nil,'universal'].include?(@cpu) or [nil, 'universal'].include?(other.cpu) or @cpu == other.cpu or
- (@cpu == 'arm' and other.cpu =~ /\Aarm/)) and
# os
@os == other.os and
@@ -109,7 +109,7 @@ class Gem::Security::Signer
subject_alt_name = cert.extensions.find { |e| 'subjectAltName' == e.oid }
if subject_alt_name
- /\Aemail:/ =~ subject_alt_name.value
$' || subject_alt_name.value
else
@@ -1151,7 +1151,7 @@ class Gem::Specification < Gem::BasicSpecification
def self.normalize_yaml_input(input)
result = input.respond_to?(:read) ? input.read : input
- result = "--- " + result unless result =~ /\A--- /
result = result.dup
result.gsub!(/ !!null \n/, " \n")
# date: 2011-04-26 00:00:00.000000000Z
@@ -2104,7 +2104,7 @@ class Gem::Specification < Gem::BasicSpecification
end
if @specification_version > CURRENT_SPECIFICATION_VERSION and
- sym.to_s.end_with?("=")
warn "ignoring #{sym} loading #{full_name}" if $DEBUG
else
super