You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using autocorrect (rubocop -a) with Layout/TrailingWhitespace and Lint/EmptyInterpolation causes infinite loops when encountering empty lines containing only indentation within heredocs.
Expected behavior
No infinite loop.
Actual behavior
rubocop -a --debug
For ~/Code/linebreak_heredoc: Default configuration from ~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/config/default.yml
Inspecting 1 file
Scanning ~/Code/linebreak_heredoc/test.rb
W
Offenses:
test.rb:8:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
test.rb:8:5: W: [Corrected] Lint/EmptyInterpolation: Empty interpolation detected.
#{}
^^^
0 files inspected, 2 offenses detected, 2 offenses corrected
Infinite loop detected in ~/Code/linebreak_heredoc/test.rb and caused by Layout/TrailingWhitespace -> Lint/EmptyInterpolation
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:304:in `check_for_infinite_loop'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:287:in `block in iterate_until_no_changes'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:286:in `loop'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:286:in `iterate_until_no_changes'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:255:in `do_inspection_loop'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:132:in `block in file_offenses'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:157:in `file_offense_cache'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:131:in `file_offenses'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:122:in `process_file'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:101:in `block in each_inspected_file'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:100:in `each'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:100:in `reduce'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:100:in `each_inspected_file'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:86:in `inspect_files'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/runner.rb:47:in `run'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/cli/command.rb:11:in `run'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/cli/environment.rb:18:in `run'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/cli.rb:65:in `run_command'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/cli.rb:72:in `execute_runners'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/lib/rubocop/cli.rb:41:in `run'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/exe/rubocop:13:in `block in <top (required)>'
~/.rbenv/versions/2.7.0/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
~/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rubocop-1.0.0/exe/rubocop:12:in `<top (required)>'
~/.rbenv/versions/2.7.0/bin/rubocop:23:in `load'
~/.rbenv/versions/2.7.0/bin/rubocop:23:in `<main>'
Finished in 0.1126139999832958 seconds
Steps to reproduce the problem
This is test.rb from the above output – note that the first empty line contains 4 spaces.
#! /usr/bin/env ruby -w
# frozen_string_literal: true
def testcase
puts <<-TXT
empty breaking lines
looping infinitely on
each rubocop run
TXT
end
testcase
Using autocorrect (
rubocop -a
) withLayout/TrailingWhitespace
andLint/EmptyInterpolation
causes infinite loops when encountering empty lines containing only indentation within heredocs.Expected behavior
No infinite loop.
Actual behavior
Steps to reproduce the problem
This is test.rb from the above output – note that the first empty line contains 4 spaces.
RuboCop version
The text was updated successfully, but these errors were encountered: