From d07b36b2e63b2b51feb0a935fe7e7c4bb169c1c3 Mon Sep 17 00:00:00 2001 From: Robert Haines Date: Sun, 9 Feb 2020 22:44:08 +0000 Subject: [PATCH] Fix Style/TernaryParentheses cop. --- .rubocop_todo.yml | 9 --------- lib/zip/crypto/decrypted_io.rb | 2 +- lib/zip/inflater.rb | 2 +- lib/zip/pass_thru_decompressor.rb | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1b7af43..283ebbd 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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. diff --git a/lib/zip/crypto/decrypted_io.rb b/lib/zip/crypto/decrypted_io.rb index 8d8191f..61a377d 100644 --- a/lib/zip/crypto/decrypted_io.rb +++ b/lib/zip/crypto/decrypted_io.rb @@ -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? diff --git a/lib/zip/inflater.rb b/lib/zip/inflater.rb index 609ccc7..530f98a 100644 --- a/lib/zip/inflater.rb +++ b/lib/zip/inflater.rb @@ -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? diff --git a/lib/zip/pass_thru_decompressor.rb b/lib/zip/pass_thru_decompressor.rb index d7892ce..e638540 100644 --- a/lib/zip/pass_thru_decompressor.rb +++ b/lib/zip/pass_thru_decompressor.rb @@ -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