diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 47c6e63..12fdade 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -162,14 +162,6 @@ Style/ModuleFunction: Style/MutableConstant: Enabled: false -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, MinBodyLength. -# SupportedStyles: skip_modifier_ifs, always -Style/Next: - Exclude: - - 'lib/zip/entry.rb' - # Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: EnforcedOctalStyle. diff --git a/lib/zip/entry.rb b/lib/zip/entry.rb index 44b3319..a3ad499 100644 --- a/lib/zip/entry.rb +++ b/lib/zip/entry.rb @@ -625,13 +625,13 @@ module Zip while (buf = is.sysread(::Zip::Decompressor::CHUNK_SIZE, buf)) os << buf bytes_written += buf.bytesize - if bytes_written > size && !warned - message = "entry '#{name}' should be #{size}B, but is larger when inflated." - raise ::Zip::EntrySizeError, message if ::Zip.validate_entry_sizes + next unless bytes_written > size && !warned - warn "WARNING: #{message}" - warned = true - end + message = "entry '#{name}' should be #{size}B, but is larger when inflated." + raise ::Zip::EntrySizeError, message if ::Zip.validate_entry_sizes + + warn "WARNING: #{message}" + warned = true end end end