From b528cae0849be758ea8b45f978422b99633b5fc6 Mon Sep 17 00:00:00 2001 From: Robert Haines Date: Sun, 9 Feb 2020 11:01:57 +0000 Subject: [PATCH] Fix Lint/LiteralAsCondition cop. This fixes Style/InfiniteLoop as a side-effect. --- .rubocop_todo.yml | 11 ----------- lib/zip/ioextras/abstract_input_stream.rb | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5bdd4fc..d3567a0 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -31,11 +31,6 @@ Layout/HashAlignment: - 'lib/zip/file.rb' - 'rubyzip.gemspec' -# Offense count: 1 -Lint/LiteralAsCondition: - Exclude: - - 'lib/zip/ioextras/abstract_input_stream.rb' - # Offense count: 1 Lint/RescueException: Exclude: @@ -283,12 +278,6 @@ Style/IfUnlessModifier: - 'lib/zip/pass_thru_decompressor.rb' - 'lib/zip/streamable_stream.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Style/InfiniteLoop: - Exclude: - - 'lib/zip/ioextras/abstract_input_stream.rb' - # Offense count: 1 Style/MixinUsage: Exclude: diff --git a/lib/zip/ioextras/abstract_input_stream.rb b/lib/zip/ioextras/abstract_input_stream.rb index 58678a3..60743b2 100644 --- a/lib/zip/ioextras/abstract_input_stream.rb +++ b/lib/zip/ioextras/abstract_input_stream.rb @@ -101,7 +101,7 @@ module Zip end def each_line(a_sep_string = $/) - yield readline(a_sep_string) while true + loop { yield readline(a_sep_string) } rescue EOFError end