fix rubocop Style/ColonMethodCall cop

This commit is contained in:
Pavel Lobashov 2015-03-21 11:16:06 +03:00
parent a0da550c22
commit 6c46c21abb
8 changed files with 23 additions and 28 deletions

View File

@ -87,11 +87,6 @@ Style/ClassCheck:
Style/ClassMethods:
Enabled: false
# Offense count: 15
# Cop supports --auto-correct.
Style/ColonMethodCall:
Enabled: false
# Offense count: 1
# Configuration parameters: Keywords.
Style/CommentAnnotation:

View File

@ -13,7 +13,7 @@ module Zip
def << (data)
val = data.to_s
@crc = Zlib::crc32(val, @crc)
@crc = Zlib.crc32(val, @crc)
@size += val.bytesize
@buffer_stream << @zlib_deflater.deflate(data)
end

View File

@ -374,9 +374,9 @@ module Zip
def file_stat(path) # :nodoc:
if @follow_symlinks
::File::stat(path)
::File.stat(path)
else
::File::lstat(path)
::File.lstat(path)
end
end
@ -595,7 +595,7 @@ module Zip
return if ::File.directory?(dest_path)
if ::File.exist?(dest_path)
if block_given? && yield(self, dest_path)
::FileUtils::rm_f dest_path
::FileUtils.rm_f dest_path
else
raise ::Zip::DestinationFileExistsError,
"Cannot create directory '#{dest_path}'. "+

View File

@ -3,13 +3,13 @@ module Zip
def initialize(outputStream)
super()
@output_stream = outputStream
@crc = Zlib::crc32
@crc = Zlib.crc32
@size = 0
end
def << (data)
val = data.to_s
@crc = Zlib::crc32(val, @crc)
@crc = Zlib.crc32(val, @crc)
@size += val.bytesize
@output_stream << val
end

View File

@ -15,8 +15,8 @@ class ZipFileExtractTest < MiniTest::Test
zf.extract(ENTRY_TO_EXTRACT, EXTRACTED_FILENAME)
assert(File.exist?(EXTRACTED_FILENAME))
AssertEntry::assert_contents(EXTRACTED_FILENAME,
zf.get_input_stream(ENTRY_TO_EXTRACT) { |is| is.read })
AssertEntry.assert_contents(EXTRACTED_FILENAME,
zf.get_input_stream(ENTRY_TO_EXTRACT) { |is| is.read })
::File.unlink(EXTRACTED_FILENAME)
@ -25,8 +25,8 @@ class ZipFileExtractTest < MiniTest::Test
entry.extract(EXTRACTED_FILENAME)
assert(File.exist?(EXTRACTED_FILENAME))
AssertEntry::assert_contents(EXTRACTED_FILENAME,
entry.get_input_stream() { |is| is.read })
AssertEntry.assert_contents(EXTRACTED_FILENAME,
entry.get_input_stream() { |is| is.read })
end
end

View File

@ -41,8 +41,8 @@ class ZipFileSplitTest < MiniTest::Test
zf.extract(ENTRY_TO_EXTRACT, EXTRACTED_FILENAME)
assert(File.exist?(EXTRACTED_FILENAME))
AssertEntry::assert_contents(EXTRACTED_FILENAME,
zf.get_input_stream(ENTRY_TO_EXTRACT) { |is| is.read })
AssertEntry.assert_contents(EXTRACTED_FILENAME,
zf.get_input_stream(ENTRY_TO_EXTRACT) { |is| is.read })
File.unlink(EXTRACTED_FILENAME)
@ -51,8 +51,8 @@ class ZipFileSplitTest < MiniTest::Test
entry.extract(EXTRACTED_FILENAME)
assert(File.exist?(EXTRACTED_FILENAME))
AssertEntry::assert_contents(EXTRACTED_FILENAME,
entry.get_input_stream() { |is| is.read })
AssertEntry.assert_contents(EXTRACTED_FILENAME,
entry.get_input_stream() { |is| is.read })
end
end

View File

@ -293,14 +293,14 @@ class ZipFileTest < MiniTest::Test
zf.close
zfRead = ::Zip::File.new(TEST_ZIP.zip_name)
AssertEntry::assert_contents(newEntrySrcFilename,
zfRead.get_input_stream(entryToReplace) { |is| is.read })
AssertEntry::assert_contents(TEST_ZIP.entry_names[0],
zfRead.get_input_stream(TEST_ZIP.entry_names[0]) { |is| is.read })
AssertEntry::assert_contents(TEST_ZIP.entry_names[1],
zfRead.get_input_stream(TEST_ZIP.entry_names[1]) { |is| is.read })
AssertEntry::assert_contents(TEST_ZIP.entry_names[3],
zfRead.get_input_stream(TEST_ZIP.entry_names[3]) { |is| is.read })
AssertEntry.assert_contents(newEntrySrcFilename,
zfRead.get_input_stream(entryToReplace) { |is| is.read })
AssertEntry.assert_contents(TEST_ZIP.entry_names[0],
zfRead.get_input_stream(TEST_ZIP.entry_names[0]) { |is| is.read })
AssertEntry.assert_contents(TEST_ZIP.entry_names[1],
zfRead.get_input_stream(TEST_ZIP.entry_names[1]) { |is| is.read })
AssertEntry.assert_contents(TEST_ZIP.entry_names[3],
zfRead.get_input_stream(TEST_ZIP.entry_names[3]) { |is| is.read })
zfRead.close
end

View File

@ -88,7 +88,7 @@ class ZipOutputStreamTest < MiniTest::Test
zos << file.read
end
::Zip::InputStream::open(TEST_ZIP.zip_name) do |io|
::Zip::InputStream.open(TEST_ZIP.zip_name) do |io|
while (entry = io.get_next_entry)
assert(::Zip::DOSTime.at(file.mtime).dos_equals(::Zip::DOSTime.at(entry.mtime))) # Compare DOS Times, since they are stored with two seconds accuracy
end