fix rubocop cop Style/ClassCheck

This commit is contained in:
Pavel Lobashov 2015-06-08 10:36:41 +03:00
parent 753eab15d9
commit 8c13dfc265
8 changed files with 15 additions and 21 deletions

View File

@ -73,12 +73,6 @@ Style/BlockDelimiters:
Style/ClassAndModuleChildren:
Enabled: false
# Offense count: 15
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassCheck:
Enabled: false
# Offense count: 77
Style/Documentation:
Enabled: false

View File

@ -17,7 +17,7 @@ module Zip
def initialize(entries = EntrySet.new, comment = '') #:nodoc:
super()
@entry_set = entries.kind_of?(EntrySet) ? entries : EntrySet.new(entries)
@entry_set = entries.is_a?(EntrySet) ? entries : EntrySet.new(entries)
@comment = comment
end
@ -197,7 +197,7 @@ module Zip
end
def ==(other) #:nodoc:
return false unless other.kind_of?(CentralDirectory)
return false unless other.is_a?(CentralDirectory)
@entry_set.entries.sort == other.entries.sort && comment == other.comment
end
end

View File

@ -49,7 +49,7 @@ module Zip
end
def ==(other)
return false unless other.kind_of?(EntrySet)
return false unless other.is_a?(EntrySet)
@entry_set.values == other.entry_set.values
end

View File

@ -235,7 +235,7 @@ module Zip
# File.open method.
def get_output_stream(entry, permission_int = nil, comment = nil, extra = nil, compressed_size = nil, crc = nil, compression_method = nil, size = nil, time = nil, &aProc)
new_entry =
if entry.kind_of?(Entry)
if entry.is_a?(Entry)
entry
else
Entry.new(@name, entry.to_s, comment, extra, compressed_size, crc, compression_method, size, time)
@ -264,7 +264,7 @@ module Zip
def add(entry, src_path, &continue_on_exists_proc)
continue_on_exists_proc ||= proc { ::Zip.continue_on_exists_proc }
check_entry_exists(entry, continue_on_exists_proc, 'add')
new_entry = entry.kind_of?(::Zip::Entry) ? entry : ::Zip::Entry.new(@name, entry.to_s)
new_entry = entry.is_a?(::Zip::Entry) ? entry : ::Zip::Entry.new(@name, entry.to_s)
new_entry.gather_fileinfo_from_srcpath(src_path)
new_entry.dirty = true
@entry_set << new_entry

View File

@ -87,7 +87,7 @@ module Zip
# +entry+ can be a ZipEntry object or a string.
def put_next_entry(entry_name, comment = nil, extra = nil, compression_method = Entry::DEFLATED, level = Zip.default_compression)
raise Error, 'zip stream is closed' if @closed
if entry_name.kind_of?(Entry)
if entry_name.is_a?(Entry)
new_entry = entry_name
else
new_entry = Entry.new(@file_name, entry_name.to_s)

View File

@ -384,7 +384,7 @@ class ZipFsFileNonmutatingTest < MiniTest::Test
def test_stat
s = @zip_file.file.stat('file1')
assert(s.kind_of?(File::Stat)) # It pretends
assert(s.is_a?(File::Stat)) # It pretends
assert_raises(Errno::ENOENT, 'No such file or directory - noSuchFile') do
@zip_file.file.stat('noSuchFile')
end

View File

@ -9,10 +9,10 @@ class FakeIOTest < MiniTest::Test
def test_kind_of?
obj = FakeIOUsingClass.new
assert(obj.kind_of?(Object))
assert(obj.kind_of?(FakeIOUsingClass))
assert(obj.kind_of?(IO))
assert(!obj.kind_of?(Fixnum))
assert(!obj.kind_of?(String))
assert(obj.is_a?(Object))
assert(obj.is_a?(FakeIOUsingClass))
assert(obj.is_a?(IO))
assert(!obj.is_a?(Fixnum))
assert(!obj.is_a?(String))
end
end

View File

@ -58,9 +58,9 @@ class ZipOutputStreamTest < MiniTest::Test
begin
::Zip::OutputStream.open(name)
rescue Exception
assert($!.kind_of?(Errno::EISDIR) || # Linux
$!.kind_of?(Errno::EEXIST) || # Windows/cygwin
$!.kind_of?(Errno::EACCES), # Windows
assert($!.is_a?(Errno::EISDIR) || # Linux
$!.is_a?(Errno::EEXIST) || # Windows/cygwin
$!.is_a?(Errno::EACCES), # Windows
"Expected Errno::EISDIR (or on win/cygwin: Errno::EEXIST), but was: #{$!.class}")
end
end