[rubygems/rubygems] Let RuboCop target Ruby 3.0

https://github.com/rubygems/rubygems/commit/70243b1d72
This commit is contained in:
David Rodríguez 2023-10-26 22:17:09 +02:00 committed by Hiroshi SHIBATA
parent 50482cd1e5
commit a4d80eee17
17 changed files with 32 additions and 32 deletions

View File

@ -6,8 +6,8 @@ require "fiddle"
module Bundler
class CLI::Doctor
DARWIN_REGEX = /\s+(.+) \(compatibility /.freeze
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/.freeze
DARWIN_REGEX = /\s+(.+) \(compatibility /
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/
attr_reader :options

View File

@ -18,7 +18,7 @@ module Bundler
VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
platform platforms type source install_if gemfile force_ruby_platform].freeze
GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}.freeze
GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}
attr_reader :gemspecs
attr_accessor :dependencies

View File

@ -36,7 +36,7 @@ module Bundler
PATH = "PATH"
PLUGIN = "PLUGIN SOURCE"
SPECS = " specs:"
OPTIONS = /^ ([a-z]+): (.*)$/i.freeze
OPTIONS = /^ ([a-z]+): (.*)$/i
SOURCE = [GIT, GEM, PATH, PLUGIN].freeze
SECTIONS_BY_VERSION_INTRODUCED = {
@ -183,7 +183,7 @@ module Bundler
(!)? # Optional pinned marker
(?:#{space}([^ ]+))? # Optional checksum
$ # Line end
/xo.freeze
/xo
def parse_dependency(line)
return unless line =~ NAME_VERSION

View File

@ -49,7 +49,7 @@ module Bundler
(\d+\.\d+\.\d+(?:\.\S+)?) # ruby version
(?:p(-?\d+))? # optional patchlevel
(?:\s\((\S+)\s(.+)\))? # optional engine info
/xo.freeze
/xo
# Returns a RubyVersion from the given string.
# @param [String] the version string to match.

View File

@ -509,7 +509,7 @@ module Bundler
(https?.*?) # URI
(\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
\z
/ix.freeze
/ix
def self.key_for(key)
key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")

View File

@ -36,7 +36,7 @@ module Bundler
(.*) # value
\1 # matching closing quote
$
/xo.freeze
/xo
HASH_REGEX = /
^
@ -48,7 +48,7 @@ module Bundler
(.*) # value
\3 # matching closing quote
$
/xo.freeze
/xo
def load(str)
res = {}

View File

@ -1287,7 +1287,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
##
# Location of Marshal quick gemspecs on remote repositories
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/".freeze
autoload :ConfigFile, File.expand_path("rubygems/config_file", __dir__)
autoload :Dependency, File.expand_path("rubygems/dependency", __dir__)

View File

@ -7,8 +7,8 @@ require_relative "../command"
# RubyGems checkout or tarball.
class Gem::Commands::SetupCommand < Gem::Command
HISTORY_HEADER = %r{^#\s*[\d.a-zA-Z]+\s*/\s*\d{4}-\d{2}-\d{2}\s*$}.freeze
VERSION_MATCHER = %r{^#\s*([\d.a-zA-Z]+)\s*/\s*\d{4}-\d{2}-\d{2}\s*$}.freeze
HISTORY_HEADER = %r{^#\s*[\d.a-zA-Z]+\s*/\s*\d{4}-\d{2}-\d{2}\s*$}
VERSION_MATCHER = %r{^#\s*([\d.a-zA-Z]+)\s*/\s*\d{4}-\d{2}-\d{2}\s*$}
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze

View File

@ -23,12 +23,12 @@ class Gem::Requirement
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
quoted = OPS.keys.map {|k| Regexp.quote k }.join "|"
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc:
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*".freeze # :nodoc:
##
# A regular expression that matches a requirement
PATTERN = /\A#{PATTERN_RAW}\z/.freeze
PATTERN = /\A#{PATTERN_RAW}\z/
##
# The default requirement matches any non-prerelease version

View File

@ -108,7 +108,7 @@ class Gem::Specification < Gem::BasicSpecification
@load_cache = {} # :nodoc:
@load_cache_mutex = Thread::Mutex.new
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/.freeze # :nodoc:
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/ # :nodoc:
# :startdoc:
@ -1756,7 +1756,7 @@ class Gem::Specification < Gem::BasicSpecification
/\A
(\d{4})-(\d{2})-(\d{2})
(\s+ \d{2}:\d{2}:\d{2}\.\d+ \s* (Z | [-+]\d\d:\d\d) )?
\Z/x.freeze
\Z/x
##
# The date this gem was created

View File

@ -5,11 +5,11 @@ require_relative "user_interaction"
class Gem::SpecificationPolicy
include Gem::UserInteraction
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/.freeze # :nodoc:
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/ # :nodoc:
SPECIAL_CHARACTERS = /\A[#{Regexp.escape('.-_')}]+/.freeze # :nodoc:
SPECIAL_CHARACTERS = /\A[#{Regexp.escape('.-_')}]+/ # :nodoc:
VALID_URI_PATTERN = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}.freeze # :nodoc:
VALID_URI_PATTERN = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z} # :nodoc:
METADATA_LINK_KEYS = %w[
bug_tracker_uri
@ -400,8 +400,8 @@ or set it to nil if you don't want to specify a license.
end
LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, "")
LAZY_PATTERN = /\AFI XME|\ATO DO/x.freeze
HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze
LAZY_PATTERN = /\AFI XME|\ATO DO/x
HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i
def validate_lazy_metadata
unless @specification.authors.grep(LAZY_PATTERN).empty?

View File

@ -697,7 +697,7 @@ class Gem::Licenses
| #{LICENSE_REF}
)
\Z
/ox.freeze
/ox
DEPRECATED_LICENSE_REGEXP = /
\A
@ -705,7 +705,7 @@ class Gem::Licenses
\+?
(?:\s WITH \s .+?)?
\Z
/ox.freeze
/ox
DEPRECATED_EXCEPTION_REGEXP = /
\A
@ -713,7 +713,7 @@ class Gem::Licenses
\+?
(?:\s WITH \s #{Regexp.union(DEPRECATED_EXCEPTION_IDENTIFIERS)})
\Z
/ox.freeze
/ox
def self.match?(license)
VALID_REGEXP.match?(license)

View File

@ -156,7 +156,7 @@ class Gem::Version
include Comparable
VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/.freeze # :nodoc:
ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
##
# A string representation of this Version.

View File

@ -36,7 +36,7 @@ module Gem
(.*) # value
\1 # matching closing quote
$
/xo.freeze
/xo
HASH_REGEX = /
^
@ -48,7 +48,7 @@ module Gem
(.*) # value
\3 # matching closing quote
$
/xo.freeze
/xo
def load(str)
res = {}

View File

@ -4,9 +4,9 @@ require_relative "../support/path"
RSpec.describe "bundle version" do
if Spec::Path.ruby_core?
COMMIT_HASH = /unknown|[a-fA-F0-9]{7,}/.freeze
COMMIT_HASH = /unknown|[a-fA-F0-9]{7,}/
else
COMMIT_HASH = /[a-fA-F0-9]{7,}/.freeze
COMMIT_HASH = /[a-fA-F0-9]{7,}/
end
context "with -v" do

View File

@ -3,8 +3,8 @@
require "net/http"
require_relative "../path"
CASSETTE_PATH = "#{Spec::Path.spec_dir}/support/artifice/vcr_cassettes"
USED_CASSETTES_PATH = "#{Spec::Path.spec_dir}/support/artifice/used_cassettes.txt"
CASSETTE_PATH = "#{Spec::Path.spec_dir}/support/artifice/vcr_cassettes".freeze
USED_CASSETTES_PATH = "#{Spec::Path.spec_dir}/support/artifice/used_cassettes.txt".freeze
CASSETTE_NAME = ENV.fetch("BUNDLER_SPEC_VCR_CASSETTE_NAME") { "realworld" }
class BundlerVCRHTTP < Net::HTTP

View File

@ -43,7 +43,7 @@ module Spec
last_command.stderr
end
MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/.freeze
MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/
def err_without_deprecations
err.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "")