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