summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2020-03-24 19:51:43 +0100
committerHiroshi SHIBATA <[email protected]>2020-03-30 12:42:10 +0900
commitba9dcdab3669f11b2e265712ceb43227c366fc3b (patch)
treee6aa19535d1b3388c9303497e1dc649e9e804ed8
parentf987302cf4a59944e5f01572d8ac36bbdbbc97cc (diff)
[rubygems/rubygems] Enable Style/PercentLiteralDelimiters cop in rubygems
So it matches the style used by bundler. https://github.com/rubygems/rubygems/commit/ab0580fd65
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/commands/setup_command.rb2
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb2
-rw-r--r--lib/rubygems/safe_yaml.rb8
-rw-r--r--lib/rubygems/server.rb2
-rw-r--r--lib/rubygems/source/git.rb4
-rw-r--r--lib/rubygems/specification.rb2
-rw-r--r--lib/rubygems/test_case.rb4
-rw-r--r--lib/rubygems/test_utilities.rb4
-rw-r--r--lib/rubygems/util/licenses.rb8
-rw-r--r--test/rubygems/test_gem.rb40
-rw-r--r--test/rubygems/test_gem_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb28
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb42
-rw-r--r--test/rubygems/test_gem_commands_info_command.rb12
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_mirror.rb2
-rw-r--r--test/rubygems/test_gem_commands_open_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb36
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb12
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb4
-rw-r--r--test/rubygems/test_gem_dependency_resolution_error.rb2
-rw-r--r--test/rubygems/test_gem_ext_builder.rb24
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb10
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb2
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb18
-rw-r--r--test/rubygems/test_gem_indexer.rb16
-rw-r--r--test/rubygems/test_gem_installer.rb36
-rw-r--r--test/rubygems/test_gem_package.rb4
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb2
-rw-r--r--test/rubygems/test_gem_request.rb22
-rw-r--r--test/rubygems/test_gem_request_set.rb4
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb2
-rw-r--r--test/rubygems/test_gem_resolver.rb2
-rw-r--r--test/rubygems/test_gem_security_signer.rb2
-rw-r--r--test/rubygems/test_gem_server.rb20
-rw-r--r--test/rubygems/test_gem_specification.rb96
-rw-r--r--test/rubygems/test_gem_uninstaller.rb26
-rw-r--r--test/rubygems/test_require.rb44
47 files changed, 303 insertions, 303 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 9bd4e9be20..73321ec47b 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1011,7 +1011,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.suffixes
@suffixes ||= ['',
'.rb',
- *%w(DLEXT DLEXT2).map do |key|
+ *%w[DLEXT DLEXT2].map do |key|
val = RbConfig::CONFIG[key]
next unless val and not val.empty?
".#{val}"
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index d67caca91c..679803c338 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -546,7 +546,7 @@ abort "#{deprecation_message}"
next unless Gem.win_platform?
File.open "#{old_bin_path}.bat", 'w' do |fp|
- fp.puts %{@ECHO.#{deprecation_message}}
+ fp.puts %(@ECHO.#{deprecation_message})
end
end
end
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index 88be7ecfe8..d06e923a30 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -27,7 +27,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
# Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940
tmp_dest = get_relative_path(tmp_dest)
- Tempfile.open %w"siteconf .rb", "." do |siteconf|
+ Tempfile.open %w[siteconf .rb], "." do |siteconf|
siteconf.puts "require 'rbconfig'"
siteconf.puts "dest_path = #{tmp_dest.dump}"
%w[sitearchdir sitelibdir].each do |dir|
diff --git a/lib/rubygems/safe_yaml.rb b/lib/rubygems/safe_yaml.rb
index 3540fd74dd..29312ad5a1 100644
--- a/lib/rubygems/safe_yaml.rb
+++ b/lib/rubygems/safe_yaml.rb
@@ -7,7 +7,7 @@ module Gem
# Psych.safe_load
module SafeYAML
- PERMITTED_CLASSES = %w(
+ PERMITTED_CLASSES = %w[
Symbol
Time
Date
@@ -19,12 +19,12 @@ module Gem
Gem::Version::Requirement
YAML::Syck::DefaultKey
Syck::DefaultKey
- ).freeze
+ ].freeze
- PERMITTED_SYMBOLS = %w(
+ PERMITTED_SYMBOLS = %w[
development
runtime
- ).freeze
+ ].freeze
if ::YAML.respond_to? :safe_load
def self.safe_load(input)
diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb
index 83d7cf5abc..b2130852e0 100644
--- a/lib/rubygems/server.rb
+++ b/lib/rubygems/server.rb
@@ -573,7 +573,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
add_date res
case req.request_uri.path
- when %r|^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)\.gemspec\.rz$| then
+ when %r{^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)\.gemspec\.rz$} then
marshal_format, full_name = $1, $2
specs = Gem::Specification.find_all_by_full_name(full_name)
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb
index 0b8a4339cc..ec2c371fa9 100644
--- a/lib/rubygems/source/git.rb
+++ b/lib/rubygems/source/git.rb
@@ -228,8 +228,8 @@ class Gem::Source::Git < Gem::Source
require 'digest' # required here to avoid deadlocking in Gem.activate_bin_path (because digest is a gem on 2.5+)
normalized =
- if @repository =~ %r%^\w+://(\w+@)?%
- uri = URI(@repository).normalize.to_s.sub %r%/$%,''
+ if @repository =~ %r{^\w+://(\w+@)?}
+ uri = URI(@repository).normalize.to_s.sub %r{/$},''
uri.sub(/\A(\w+)/) { $1.downcase }
else
@repository
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 3181303c30..3a2a6090fd 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -2188,7 +2188,7 @@ class Gem::Specification < Gem::BasicSpecification
attributes.each do |attr_name|
current_value = self.send attr_name
- current_value = current_value.sort if %i(files test_files).include? attr_name
+ current_value = current_value.sort if %i[files test_files].include? attr_name
if current_value != default_value(attr_name) or
self.class.required_attribute? attr_name
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index ebfe979a1b..27b70222c9 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -576,7 +576,7 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
end
def in_path?(executable) # :nodoc:
- return true if %r%\A([A-Z]:|/)% =~ executable and File.exist? executable
+ return true if %r{\A([A-Z]:|/)} =~ executable and File.exist? executable
ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory|
File.exist? File.join directory, executable
@@ -1286,7 +1286,7 @@ Also, a list:
def escape_path(*path)
path = File.join(*path)
- if %r'\A[-+:/=@,.\w]+\z' =~ path
+ if %r{\A[-+:/=@,.\w]+\z} =~ path
path
else
"\"#{path.gsub(/[`$"]/, '\\&')}\""
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb
index 69ff05370e..6ae3c0e986 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/lib/rubygems/test_utilities.rb
@@ -49,7 +49,7 @@ class Gem::FakeFetcher
path = path.to_s
@paths << path
- raise ArgumentError, 'need full URI' unless path =~ %r'^https?://'
+ raise ArgumentError, 'need full URI' unless path =~ %r{^https?://}
unless @data.key? path
raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
@@ -121,7 +121,7 @@ class Gem::FakeFetcher
path = path.to_s
@paths << path
- raise ArgumentError, 'need full URI' unless path =~ %r'^http://'
+ raise ArgumentError, 'need full URI' unless path =~ %r{^http://}
unless @data.key? path
raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
diff --git a/lib/rubygems/util/licenses.rb b/lib/rubygems/util/licenses.rb
index f23be157b9..5b82667785 100644
--- a/lib/rubygems/util/licenses.rb
+++ b/lib/rubygems/util/licenses.rb
@@ -9,7 +9,7 @@ class Gem::Licenses
# Software Package Data Exchange (SPDX) standard open-source software
# license identifiers
- LICENSE_IDENTIFIERS = %w(
+ LICENSE_IDENTIFIERS = %w[
0BSD
AAL
ADSL
@@ -379,10 +379,10 @@ class Gem::Licenses
xinetd
xpp
zlib-acknowledgement
- ).freeze
+ ].freeze
# exception identifiers
- EXCEPTION_IDENTIFIERS = %w(
+ EXCEPTION_IDENTIFIERS = %w[
389-exception
Autoconf-exception-2.0
Autoconf-exception-3.0
@@ -410,7 +410,7 @@ class Gem::Licenses
mif-exception
openvpn-openssl-exception
u-boot-exception-2.0
- ).freeze
+ ].freeze
REGEXP = %r{
\A
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index fd9b3609f2..0c7e0f7502 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -42,12 +42,12 @@ class TestGem < Gem::TestCase
a1.activate
- assert_equal %w(a-1), loaded_spec_names
+ assert_equal %w[a-1], loaded_spec_names
assert_equal ["b (> 0)"], unresolved_names
Gem.finish_resolve
- assert_equal %w(a-1 b-2 c-2), loaded_spec_names
+ assert_equal %w[a-1 b-2 c-2], loaded_spec_names
assert_equal [], unresolved_names
end
end
@@ -66,12 +66,12 @@ class TestGem < Gem::TestCase
a1.activate
- assert_equal %w(a-1), loaded_spec_names
+ assert_equal %w[a-1], loaded_spec_names
assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
Gem.finish_resolve
- assert_equal %w(a-1 b-1 c-1 d-2), loaded_spec_names
+ assert_equal %w[a-1 b-1 c-1 d-2], loaded_spec_names
assert_equal [], unresolved_names
end
end
@@ -89,12 +89,12 @@ class TestGem < Gem::TestCase
a1.activate
c1.activate
- assert_equal %w(a-1 c-1), loaded_spec_names
+ assert_equal %w[a-1 c-1], loaded_spec_names
assert_equal ["b (> 0)"], unresolved_names
Gem.finish_resolve
- assert_equal %w(a-1 b-1 c-1), loaded_spec_names
+ assert_equal %w[a-1 b-1 c-1], loaded_spec_names
assert_equal [], unresolved_names
end
end
@@ -299,7 +299,7 @@ class TestGem < Gem::TestCase
gem 'c'
Gem.finish_resolve
- assert_equal %w(a-1 b-2 c-1), loaded_spec_names
+ assert_equal %w[a-1 b-2 c-1], loaded_spec_names
end
def test_activate_bin_path_gives_proper_error_for_bundler
@@ -368,7 +368,7 @@ class TestGem < Gem::TestCase
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
- assert_equal %w(bundler-2.0.0), loaded_spec_names
+ assert_equal %w[bundler-2.0.0], loaded_spec_names
end
def test_activate_bin_path_respects_underscore_selection_if_given
@@ -402,7 +402,7 @@ class TestGem < Gem::TestCase
load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")
- assert_equal %w(bundler-1.17.3), loaded_spec_names
+ assert_equal %w[bundler-1.17.3], loaded_spec_names
end
def test_self_bin_path_no_exec_name
@@ -701,7 +701,7 @@ class TestGem < Gem::TestCase
discover_path