[rubygems/rubygems] util/rubocop -A --only Style/ClassCheck

https://github.com/rubygems/rubygems/commit/1c3356a872
This commit is contained in:
Hiroshi SHIBATA 2023-03-16 13:08:50 +09:00
Родитель 567db6064b
Коммит 0b632b9cdd
13 изменённых файлов: 19 добавлений и 19 удалений

Просмотреть файл

@ -26,7 +26,7 @@ class Gem::AvailableSet
s = o.set
when Array
s = o.map do |sp,so|
if !sp.kind_of?(Gem::Specification) || !so.kind_of?(Gem::Source)
if !sp.is_a?(Gem::Specification) || !so.is_a?(Gem::Source)
raise TypeError, "Array must be in [[spec, source], ...] form"
end

Просмотреть файл

@ -93,7 +93,7 @@ class Gem::Command
# array or a string to be split on white space.
def self.add_specific_extra_args(cmd,args)
args = args.split(/\s+/) if args.kind_of? String
args = args.split(/\s+/) if args.is_a? String
specific_extra_args_hash[cmd] = args
end

Просмотреть файл

@ -352,7 +352,7 @@ if you believe they were disclosed to a third party.
begin
content = Gem::SafeYAML.load(File.read(filename))
unless content.kind_of? Hash
unless content.is_a? Hash
warn "Failed to load #{filename} because it doesn't contain valid YAML hash"
return {}
end

Просмотреть файл

@ -36,7 +36,7 @@ module Kernel
skip_list = (ENV["GEM_SKIP"] || "").split(/:/)
raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
if gem_name.kind_of? Gem::Dependency
if gem_name.is_a? Gem::Dependency
unless Gem::Deprecate.skip
warn "#{Gem.location_of_caller.join ":"}:Warning: Kernel.gem no longer "\
"accepts a Gem::Dependency object, please pass the name "\

Просмотреть файл

@ -103,7 +103,7 @@ module Gem::Deprecate
old = "_deprecated_#{name}"
alias_method old, name
define_method name do |*args, &block|
klass = self.kind_of? Module
klass = self.is_a? Module
target = klass ? "#{self}." : "#{self.class}#"
msg = [ "NOTE: #{target}#{name} is deprecated",
repl == :none ? " with no replacement" : "; use #{repl} instead",
@ -128,7 +128,7 @@ module Gem::Deprecate
old = "_deprecated_#{name}"
alias_method old, name
define_method name do |*args, &block|
klass = self.kind_of? Module
klass = self.is_a? Module
target = klass ? "#{self}." : "#{self.class}#"
msg = [ "NOTE: #{target}#{name} is deprecated",
replacement == :none ? " with no replacement" : "; use #{replacement} instead",

Просмотреть файл

@ -116,7 +116,7 @@ module Gem::GemcutterUtilities
end
def mfa_unauthorized?(response)
response.kind_of?(Net::HTTPUnauthorized) && response.body.start_with?("You have enabled multifactor authentication")
response.is_a?(Net::HTTPUnauthorized) && response.body.start_with?("You have enabled multifactor authentication")
end
def update_scope(scope)
@ -319,6 +319,6 @@ module Gem::GemcutterUtilities
end
def api_key_forbidden?(response)
response.kind_of?(Net::HTTPForbidden) && response.body.start_with?("The API key doesn't have access")
response.is_a?(Net::HTTPForbidden) && response.body.start_with?("The API key doesn't have access")
end
end

Просмотреть файл

@ -9,7 +9,7 @@ class Gem::NameTuple
@name = name
@version = version
unless platform.kind_of? Gem::Platform
unless platform.is_a? Gem::Platform
platform = "ruby" if !platform || platform.empty?
end

Просмотреть файл

@ -356,7 +356,7 @@ class Gem::RequestSet::GemDependencyAPI
# Use the given tag for git:, gist: and github: dependencies.
def gem(name, *requirements)
options = requirements.pop if requirements.last.kind_of?(Hash)
options = requirements.pop if requirements.last.is_a?(Hash)
options ||= {}
options[:git] = @current_repository if @current_repository

Просмотреть файл

@ -24,7 +24,7 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
def installable_platform?
# BACKCOMPAT If the file is coming out of a specified file, then we
# ignore the platform. This code can be removed in RG 3.0.
return true if @source.kind_of? Gem::Source::SpecificFile
return true if @source.is_a? Gem::Source::SpecificFile
super
end

Просмотреть файл

@ -7,7 +7,7 @@ class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification
# Returns +true+ if this gem is installable for the current platform.
def installable_platform?
return true if @source.kind_of? Gem::Source::SpecificFile
return true if @source.is_a? Gem::Source::SpecificFile
super
end

Просмотреть файл

@ -126,7 +126,7 @@ class Gem::SourceList
# Gem::Source or a source URI.
def include?(other)
if other.kind_of? Gem::Source
if other.is_a? Gem::Source
@sources.include? other
else
@sources.find {|x| x.uri.to_s == other.to_s }
@ -137,7 +137,7 @@ class Gem::SourceList
# Deletes +source+ from the source list which may be a Gem::Source or a URI.
def delete(source)
if source.kind_of? Gem::Source
if source.is_a? Gem::Source
@sources.delete source
else
@sources.delete_if {|x| x.uri.to_s == source.to_s }

Просмотреть файл

@ -125,7 +125,7 @@ class Gem::SpecificationPolicy
metadata.each do |key, value|
entry = "metadata['#{key}']"
if !key.kind_of?(String)
if !key.is_a?(String)
error "metadata keys must be a String"
end
@ -133,7 +133,7 @@ class Gem::SpecificationPolicy
error "metadata key is too large (#{key.size} > 128)"
end
if !value.kind_of?(String)
if !value.is_a?(String)
error "#{entry} value must be a String"
end
@ -343,7 +343,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
String
end
unless Array === val && val.all? {|x| x.kind_of?(klass) }
unless Array === val && val.all? {|x| x.is_a?(klass) }
error "#{field} must be an Array of #{klass}"
end
end

Просмотреть файл

@ -54,7 +54,7 @@ class Gem::FakeFetcher
raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
end
if @data[path].kind_of?(Array)
if @data[path].is_a?(Array)
@data[path].shift
else
@data[path]
@ -64,7 +64,7 @@ class Gem::FakeFetcher
def create_response(uri)
data = find_data(uri)
response = data.respond_to?(:call) ? data.call : data
raise TypeError, "#{response.class} is not a type of Net::HTTPResponse" unless response.kind_of?(Net::HTTPResponse)
raise TypeError, "#{response.class} is not a type of Net::HTTPResponse" unless response.is_a?(Net::HTTPResponse)
response
end