Fix Style/TernaryParentheses cop.

This commit is contained in:
Robert Haines 2020-02-09 22:44:08 +00:00
parent fae95e3c29
commit d07b36b2e6
4 changed files with 3 additions and 12 deletions

View File

@ -168,15 +168,6 @@ Style/SafeNavigation:
- 'test/filesystem/file_nonmutating_test.rb'
- 'test/filesystem/file_stat_test.rb'
- 'test/test_helper.rb'
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
Style/TernaryParentheses:
Exclude:
- 'lib/zip/crypto/decrypted_io.rb'
- 'lib/zip/inflater.rb'
- 'lib/zip/pass_thru_decompressor.rb'
# Offense count: 1
# Cop supports --auto-correct.

View File

@ -8,7 +8,7 @@ module Zip
end
def read(length = nil, outbuf = +'')
return ((length.nil? || length.zero?) ? '' : nil) if eof
return (length.nil? || length.zero? ? '' : nil) if eof
while length.nil? || (buffer.bytesize < length)
break if input_finished?

View File

@ -8,7 +8,7 @@ module Zip
end
def read(length = nil, outbuf = '')
return ((length.nil? || length.zero?) ? '' : nil) if eof
return (length.nil? || length.zero? ? '' : nil) if eof
while length.nil? || (@buffer.bytesize < length)
break if input_finished?

View File

@ -6,7 +6,7 @@ module Zip
end
def read(length = nil, outbuf = '')
return ((length.nil? || length.zero?) ? '' : nil) if eof
return (length.nil? || length.zero? ? '' : nil) if eof
if length.nil? || (@read_so_far + length) > decompressed_size
length = decompressed_size - @read_so_far