[rubygems/rubygems] Let RuboCop target Ruby 3.0
https://github.com/rubygems/rubygems/commit/70243b1d72
This commit is contained in:
parent
50482cd1e5
commit
a4d80eee17
@ -6,8 +6,8 @@ require "fiddle"
|
|||||||
|
|
||||||
module Bundler
|
module Bundler
|
||||||
class CLI::Doctor
|
class CLI::Doctor
|
||||||
DARWIN_REGEX = /\s+(.+) \(compatibility /.freeze
|
DARWIN_REGEX = /\s+(.+) \(compatibility /
|
||||||
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/.freeze
|
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/
|
||||||
|
|
||||||
attr_reader :options
|
attr_reader :options
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ module Bundler
|
|||||||
VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
|
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
|
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_reader :gemspecs
|
||||||
attr_accessor :dependencies
|
attr_accessor :dependencies
|
||||||
|
@ -36,7 +36,7 @@ module Bundler
|
|||||||
PATH = "PATH"
|
PATH = "PATH"
|
||||||
PLUGIN = "PLUGIN SOURCE"
|
PLUGIN = "PLUGIN SOURCE"
|
||||||
SPECS = " specs:"
|
SPECS = " specs:"
|
||||||
OPTIONS = /^ ([a-z]+): (.*)$/i.freeze
|
OPTIONS = /^ ([a-z]+): (.*)$/i
|
||||||
SOURCE = [GIT, GEM, PATH, PLUGIN].freeze
|
SOURCE = [GIT, GEM, PATH, PLUGIN].freeze
|
||||||
|
|
||||||
SECTIONS_BY_VERSION_INTRODUCED = {
|
SECTIONS_BY_VERSION_INTRODUCED = {
|
||||||
@ -183,7 +183,7 @@ module Bundler
|
|||||||
(!)? # Optional pinned marker
|
(!)? # Optional pinned marker
|
||||||
(?:#{space}([^ ]+))? # Optional checksum
|
(?:#{space}([^ ]+))? # Optional checksum
|
||||||
$ # Line end
|
$ # Line end
|
||||||
/xo.freeze
|
/xo
|
||||||
|
|
||||||
def parse_dependency(line)
|
def parse_dependency(line)
|
||||||
return unless line =~ NAME_VERSION
|
return unless line =~ NAME_VERSION
|
||||||
|
@ -49,7 +49,7 @@ module Bundler
|
|||||||
(\d+\.\d+\.\d+(?:\.\S+)?) # ruby version
|
(\d+\.\d+\.\d+(?:\.\S+)?) # ruby version
|
||||||
(?:p(-?\d+))? # optional patchlevel
|
(?:p(-?\d+))? # optional patchlevel
|
||||||
(?:\s\((\S+)\s(.+)\))? # optional engine info
|
(?:\s\((\S+)\s(.+)\))? # optional engine info
|
||||||
/xo.freeze
|
/xo
|
||||||
|
|
||||||
# Returns a RubyVersion from the given string.
|
# Returns a RubyVersion from the given string.
|
||||||
# @param [String] the version string to match.
|
# @param [String] the version string to match.
|
||||||
|
@ -509,7 +509,7 @@ module Bundler
|
|||||||
(https?.*?) # URI
|
(https?.*?) # URI
|
||||||
(\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
|
(\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
|
||||||
\z
|
\z
|
||||||
/ix.freeze
|
/ix
|
||||||
|
|
||||||
def self.key_for(key)
|
def self.key_for(key)
|
||||||
key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
|
key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
|
||||||
|
@ -36,7 +36,7 @@ module Bundler
|
|||||||
(.*) # value
|
(.*) # value
|
||||||
\1 # matching closing quote
|
\1 # matching closing quote
|
||||||
$
|
$
|
||||||
/xo.freeze
|
/xo
|
||||||
|
|
||||||
HASH_REGEX = /
|
HASH_REGEX = /
|
||||||
^
|
^
|
||||||
@ -48,7 +48,7 @@ module Bundler
|
|||||||
(.*) # value
|
(.*) # value
|
||||||
\3 # matching closing quote
|
\3 # matching closing quote
|
||||||
$
|
$
|
||||||
/xo.freeze
|
/xo
|
||||||
|
|
||||||
def load(str)
|
def load(str)
|
||||||
res = {}
|
res = {}
|
||||||
|
@ -1287,7 +1287,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||||||
##
|
##
|
||||||
# Location of Marshal quick gemspecs on remote repositories
|
# 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 :ConfigFile, File.expand_path("rubygems/config_file", __dir__)
|
||||||
autoload :Dependency, File.expand_path("rubygems/dependency", __dir__)
|
autoload :Dependency, File.expand_path("rubygems/dependency", __dir__)
|
||||||
|
@ -7,8 +7,8 @@ require_relative "../command"
|
|||||||
# RubyGems checkout or tarball.
|
# RubyGems checkout or tarball.
|
||||||
|
|
||||||
class Gem::Commands::SetupCommand < Gem::Command
|
class Gem::Commands::SetupCommand < Gem::Command
|
||||||
HISTORY_HEADER = %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*$}.freeze
|
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
|
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@ class Gem::Requirement
|
|||||||
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
|
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
|
||||||
|
|
||||||
quoted = OPS.keys.map {|k| Regexp.quote k }.join "|"
|
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
|
# 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
|
# The default requirement matches any non-prerelease version
|
||||||
|
@ -108,7 +108,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
@load_cache = {} # :nodoc:
|
@load_cache = {} # :nodoc:
|
||||||
@load_cache_mutex = Thread::Mutex.new
|
@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:
|
# :startdoc:
|
||||||
|
|
||||||
@ -1756,7 +1756,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
/\A
|
/\A
|
||||||
(\d{4})-(\d{2})-(\d{2})
|
(\d{4})-(\d{2})-(\d{2})
|
||||||
(\s+ \d{2}:\d{2}:\d{2}\.\d+ \s* (Z | [-+]\d\d:\d\d) )?
|
(\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
|
# The date this gem was created
|
||||||
|
@ -5,11 +5,11 @@ require_relative "user_interaction"
|
|||||||
class Gem::SpecificationPolicy
|
class Gem::SpecificationPolicy
|
||||||
include Gem::UserInteraction
|
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[
|
METADATA_LINK_KEYS = %w[
|
||||||
bug_tracker_uri
|
bug_tracker_uri
|
||||||
@ -400,8 +400,8 @@ or set it to nil if you don't want to specify a license.
|
|||||||
end
|
end
|
||||||
|
|
||||||
LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, "")
|
LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, "")
|
||||||
LAZY_PATTERN = /\AFI XME|\ATO DO/x.freeze
|
LAZY_PATTERN = /\AFI XME|\ATO DO/x
|
||||||
HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze
|
HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i
|
||||||
|
|
||||||
def validate_lazy_metadata
|
def validate_lazy_metadata
|
||||||
unless @specification.authors.grep(LAZY_PATTERN).empty?
|
unless @specification.authors.grep(LAZY_PATTERN).empty?
|
||||||
|
@ -697,7 +697,7 @@ class Gem::Licenses
|
|||||||
| #{LICENSE_REF}
|
| #{LICENSE_REF}
|
||||||
)
|
)
|
||||||
\Z
|
\Z
|
||||||
/ox.freeze
|
/ox
|
||||||
|
|
||||||
DEPRECATED_LICENSE_REGEXP = /
|
DEPRECATED_LICENSE_REGEXP = /
|
||||||
\A
|
\A
|
||||||
@ -705,7 +705,7 @@ class Gem::Licenses
|
|||||||
\+?
|
\+?
|
||||||
(?:\s WITH \s .+?)?
|
(?:\s WITH \s .+?)?
|
||||||
\Z
|
\Z
|
||||||
/ox.freeze
|
/ox
|
||||||
|
|
||||||
DEPRECATED_EXCEPTION_REGEXP = /
|
DEPRECATED_EXCEPTION_REGEXP = /
|
||||||
\A
|
\A
|
||||||
@ -713,7 +713,7 @@ class Gem::Licenses
|
|||||||
\+?
|
\+?
|
||||||
(?:\s WITH \s #{Regexp.union(DEPRECATED_EXCEPTION_IDENTIFIERS)})
|
(?:\s WITH \s #{Regexp.union(DEPRECATED_EXCEPTION_IDENTIFIERS)})
|
||||||
\Z
|
\Z
|
||||||
/ox.freeze
|
/ox
|
||||||
|
|
||||||
def self.match?(license)
|
def self.match?(license)
|
||||||
VALID_REGEXP.match?(license)
|
VALID_REGEXP.match?(license)
|
||||||
|
@ -156,7 +156,7 @@ class Gem::Version
|
|||||||
include Comparable
|
include Comparable
|
||||||
|
|
||||||
VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
|
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.
|
# A string representation of this Version.
|
||||||
|
@ -36,7 +36,7 @@ module Gem
|
|||||||
(.*) # value
|
(.*) # value
|
||||||
\1 # matching closing quote
|
\1 # matching closing quote
|
||||||
$
|
$
|
||||||
/xo.freeze
|
/xo
|
||||||
|
|
||||||
HASH_REGEX = /
|
HASH_REGEX = /
|
||||||
^
|
^
|
||||||
@ -48,7 +48,7 @@ module Gem
|
|||||||
(.*) # value
|
(.*) # value
|
||||||
\3 # matching closing quote
|
\3 # matching closing quote
|
||||||
$
|
$
|
||||||
/xo.freeze
|
/xo
|
||||||
|
|
||||||
def load(str)
|
def load(str)
|
||||||
res = {}
|
res = {}
|
||||||
|
@ -4,9 +4,9 @@ require_relative "../support/path"
|
|||||||
|
|
||||||
RSpec.describe "bundle version" do
|
RSpec.describe "bundle version" do
|
||||||
if Spec::Path.ruby_core?
|
if Spec::Path.ruby_core?
|
||||||
COMMIT_HASH = /unknown|[a-fA-F0-9]{7,}/.freeze
|
COMMIT_HASH = /unknown|[a-fA-F0-9]{7,}/
|
||||||
else
|
else
|
||||||
COMMIT_HASH = /[a-fA-F0-9]{7,}/.freeze
|
COMMIT_HASH = /[a-fA-F0-9]{7,}/
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with -v" do
|
context "with -v" do
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
require "net/http"
|
require "net/http"
|
||||||
require_relative "../path"
|
require_relative "../path"
|
||||||
|
|
||||||
CASSETTE_PATH = "#{Spec::Path.spec_dir}/support/artifice/vcr_cassettes"
|
CASSETTE_PATH = "#{Spec::Path.spec_dir}/support/artifice/vcr_cassettes".freeze
|
||||||
USED_CASSETTES_PATH = "#{Spec::Path.spec_dir}/support/artifice/used_cassettes.txt"
|
USED_CASSETTES_PATH = "#{Spec::Path.spec_dir}/support/artifice/used_cassettes.txt".freeze
|
||||||
CASSETTE_NAME = ENV.fetch("BUNDLER_SPEC_VCR_CASSETTE_NAME") { "realworld" }
|
CASSETTE_NAME = ENV.fetch("BUNDLER_SPEC_VCR_CASSETTE_NAME") { "realworld" }
|
||||||
|
|
||||||
class BundlerVCRHTTP < Net::HTTP
|
class BundlerVCRHTTP < Net::HTTP
|
||||||
|
@ -43,7 +43,7 @@ module Spec
|
|||||||
last_command.stderr
|
last_command.stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/.freeze
|
MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/
|
||||||
|
|
||||||
def err_without_deprecations
|
def err_without_deprecations
|
||||||
err.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "")
|
err.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user