fix rubocop Style/ParenthesesAroundCondition cop
This commit is contained in:
parent
762474089a
commit
06e5a9352d
|
@ -239,12 +239,6 @@ Style/Not:
|
||||||
Style/NumericLiterals:
|
Style/NumericLiterals:
|
||||||
MinDigits: 12
|
MinDigits: 12
|
||||||
|
|
||||||
# Offense count: 15
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AllowSafeAssignment.
|
|
||||||
Style/ParenthesesAroundCondition:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: PreferredDelimiters.
|
# Configuration parameters: PreferredDelimiters.
|
||||||
|
|
|
@ -399,7 +399,7 @@ module Zip
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_extra_attributes_on_path(dest_path) # :nodoc:
|
def set_extra_attributes_on_path(dest_path) # :nodoc:
|
||||||
return unless (file? || directory?)
|
return unless file? || directory?
|
||||||
|
|
||||||
case @fstype
|
case @fstype
|
||||||
when ::Zip::FSTYPE_UNIX
|
when ::Zip::FSTYPE_UNIX
|
||||||
|
|
|
@ -18,7 +18,7 @@ module Zip
|
||||||
return if binstr.empty?
|
return if binstr.empty?
|
||||||
size, content = initial_parse(binstr)
|
size, content = initial_parse(binstr)
|
||||||
# size: 0 for central directory. 4 for local header
|
# size: 0 for central directory. 4 for local header
|
||||||
return if (!size || size == 0)
|
return if !size || size == 0
|
||||||
atime, mtime, uid, gid = content.unpack('VVvv')
|
atime, mtime, uid, gid = content.unpack('VVvv')
|
||||||
@uid ||= uid
|
@uid ||= uid
|
||||||
@gid ||= gid
|
@gid ||= gid
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Zip
|
||||||
return if binstr.empty?
|
return if binstr.empty?
|
||||||
size, content = initial_parse(binstr)
|
size, content = initial_parse(binstr)
|
||||||
# size: 0 for central directory. 4 for local header
|
# size: 0 for central directory. 4 for local header
|
||||||
return if (!size || size == 0)
|
return if !size || size == 0
|
||||||
uid, gid = content.unpack('vv')
|
uid, gid = content.unpack('vv')
|
||||||
@uid ||= uid
|
@uid ||= uid
|
||||||
@gid ||= gid
|
@gid ||= gid
|
||||||
|
|
|
@ -20,7 +20,7 @@ module Zip
|
||||||
end
|
end
|
||||||
|
|
||||||
def produce_input
|
def produce_input
|
||||||
if (@output_buffer.empty?)
|
if @output_buffer.empty?
|
||||||
internal_produce_input
|
internal_produce_input
|
||||||
else
|
else
|
||||||
@output_buffer.slice!(0...(@output_buffer.length))
|
@output_buffer.slice!(0...(@output_buffer.length))
|
||||||
|
|
|
@ -4,8 +4,8 @@ module Zip
|
||||||
super(zipfile, entry)
|
super(zipfile, entry)
|
||||||
|
|
||||||
@ftype = :directory
|
@ftype = :directory
|
||||||
entry.get_extra_attributes_from_path(srcPath) if (srcPath)
|
entry.get_extra_attributes_from_path(srcPath) if srcPath
|
||||||
@unix_perms = permissionInt if (permissionInt)
|
@unix_perms = permissionInt if permissionInt
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,7 +55,7 @@ class ZipDialog < ZipDialogUI
|
||||||
selected_items = []
|
selected_items = []
|
||||||
unselected_items = []
|
unselected_items = []
|
||||||
lv_item = entry_list_view.first_child
|
lv_item = entry_list_view.first_child
|
||||||
while (lv_item)
|
while lv_item
|
||||||
if entry_list_view.is_selected(lv_item)
|
if entry_list_view.is_selected(lv_item)
|
||||||
selected_items << lv_item.text(0)
|
selected_items << lv_item.text(0)
|
||||||
else
|
else
|
||||||
|
@ -69,7 +69,7 @@ class ZipDialog < ZipDialogUI
|
||||||
puts "items.size = #{items.size}"
|
puts "items.size = #{items.size}"
|
||||||
|
|
||||||
d = Qt::FileDialog.get_existing_directory(nil, self)
|
d = Qt::FileDialog.get_existing_directory(nil, self)
|
||||||
if (!d)
|
if !d
|
||||||
puts 'No directory chosen'
|
puts 'No directory chosen'
|
||||||
else
|
else
|
||||||
zipfile { |zf| items.each { |e| zf.extract(e, File.join(d, e)) } }
|
zipfile { |zf| items.each { |e| zf.extract(e, File.join(d, e)) } }
|
||||||
|
|
|
@ -35,13 +35,13 @@ class TestFiles
|
||||||
|
|
||||||
def create_random_ascii(filename, size)
|
def create_random_ascii(filename, size)
|
||||||
File.open(filename, 'wb') do |file|
|
File.open(filename, 'wb') do |file|
|
||||||
file << rand while (file.tell < size)
|
file << rand while file.tell < size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_random_binary(filename, size)
|
def create_random_binary(filename, size)
|
||||||
File.open(filename, 'wb') do |file|
|
File.open(filename, 'wb') do |file|
|
||||||
file << [rand].pack('V') while (file.tell < size)
|
file << [rand].pack('V') while file.tell < size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class TestZipFile
|
||||||
ziptestTxt=''
|
ziptestTxt=''
|
||||||
File.open('test/data/file2.txt') { |file| ziptestTxt=file.read }
|
File.open('test/data/file2.txt') { |file| ziptestTxt=file.read }
|
||||||
File.open('test/data/generated/longAscii.txt', 'w') do |file|
|
File.open('test/data/generated/longAscii.txt', 'w') do |file|
|
||||||
file << ziptestTxt while (file.tell < 1E5)
|
file << ziptestTxt while file.tell < 1E5
|
||||||
end
|
end
|
||||||
|
|
||||||
testBinaryPattern=''
|
testBinaryPattern=''
|
||||||
|
@ -86,7 +86,7 @@ class TestZipFile
|
||||||
testBinaryPattern *= 4
|
testBinaryPattern *= 4
|
||||||
|
|
||||||
File.open('test/data/generated/longBinary.bin', 'wb') do |file|
|
File.open('test/data/generated/longBinary.bin', 'wb') do |file|
|
||||||
file << testBinaryPattern << rand << "\0" while (file.tell < 6E5)
|
file << testBinaryPattern << rand << "\0" while file.tell < 6E5
|
||||||
end
|
end
|
||||||
|
|
||||||
raise "failed to create test zip '#{TEST_ZIP2.zip_name}'" unless system("/usr/bin/zip #{TEST_ZIP2.zip_name} #{TEST_ZIP2.entry_names.join(' ')}")
|
raise "failed to create test zip '#{TEST_ZIP2.zip_name}'" unless system("/usr/bin/zip #{TEST_ZIP2.zip_name} #{TEST_ZIP2.entry_names.join(' ')}")
|
||||||
|
|
|
@ -36,7 +36,7 @@ module IOizeString
|
||||||
else
|
else
|
||||||
raise 'Error in test method IOizeString::seek'
|
raise 'Error in test method IOizeString::seek'
|
||||||
end
|
end
|
||||||
if (newPos < 0 || newPos >= size)
|
if newPos < 0 || newPos >= size
|
||||||
raise Errno::EINVAL
|
raise Errno::EINVAL
|
||||||
else
|
else
|
||||||
@tell=newPos
|
@tell=newPos
|
||||||
|
@ -99,7 +99,7 @@ module AssertEntry
|
||||||
expected = file.read
|
expected = file.read
|
||||||
actual = zis.read
|
actual = zis.read
|
||||||
if (expected != actual)
|
if (expected != actual)
|
||||||
if ((expected && actual) && (expected.length > 400 || actual.length > 400))
|
if (expected && actual) && (expected.length > 400 || actual.length > 400)
|
||||||
zipEntryFilename=entryName+'.zipEntry'
|
zipEntryFilename=entryName+'.zipEntry'
|
||||||
File.open(zipEntryFilename, 'wb') { |entryfile| entryfile << actual }
|
File.open(zipEntryFilename, 'wb') { |entryfile| entryfile << actual }
|
||||||
fail("File '#{filename}' is different from '#{zipEntryFilename}'")
|
fail("File '#{filename}' is different from '#{zipEntryFilename}'")
|
||||||
|
@ -114,7 +114,7 @@ module AssertEntry
|
||||||
fileContents = ''
|
fileContents = ''
|
||||||
File.open(filename, 'rb') { |f| fileContents = f.read }
|
File.open(filename, 'rb') { |f| fileContents = f.read }
|
||||||
if (fileContents != aString)
|
if (fileContents != aString)
|
||||||
if (fileContents.length > 400 || aString.length > 400)
|
if fileContents.length > 400 || aString.length > 400
|
||||||
stringFile = filename + '.other'
|
stringFile = filename + '.other'
|
||||||
File.open(stringFile, 'wb') { |f| f << aString }
|
File.open(stringFile, 'wb') { |f| f << aString }
|
||||||
fail("File '#{filename}' is different from contents of string stored in '#{stringFile}'")
|
fail("File '#{filename}' is different from contents of string stored in '#{stringFile}'")
|
||||||
|
|
Loading…
Reference in New Issue