Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop detected when auto-correcting by Layout/EmptyLineBetweenDefs #8618

Closed
khiav223577 opened this issue Aug 28, 2020 · 0 comments · Fixed by #8620
Closed

Infinite loop detected when auto-correcting by Layout/EmptyLineBetweenDefs #8618

khiav223577 opened this issue Aug 28, 2020 · 0 comments · Fixed by #8620

Comments

@khiav223577
Copy link
Contributor

khiav223577 commented Aug 28, 2020

Expected behavior

Run rubocop with --auto-correct with no errors.

Actual behavior

Infinite loop detected.

Steps to reproduce the problem

Add this file:
(This is the minimal reproducible parts of the script from the forum)

zeus_video_player.rb

$imported ||= {}
$imported[:Zeus_Video_Player] = __FILE__

def xp?() false end ; def vx?() false end ; def vxace?() false end
RUBY_VERSION == '1.8.1' ? defined?(Hangup) ?
def xp?() true  end : def vx?() true  end : def vxace?() true  end

Run auto-correcting

rubocop zeus_video_player.rb --only Layout/EmptyLineBetweenDefs --auto-correct

Error messages

Inspecting 1 file
C

Offenses:

zeus_video_player.rb:4:23: C: [Corrected] Layout/EmptyLineBetweenDefs: Use empty lines between method definitions.
def xp?() false end ; def vx?() false end ; def vxace?() false end
                      ^^^^^^^
zeus_video_player.rb:4:45: C: [Corrected] Layout/EmptyLineBetweenDefs: Use empty lines between method definitions.
def xp?() false end ; def vx?() false end ; def vxace?() false end
                                            ^^^^^^^^^^

0 files inspected, 2 offenses detected, 2 offenses corrected
Infinite loop detected in /mnt/c/Users/b9990/Dropbox/khiav/回音 git 版/echo/zeus_video_player.rb.
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:274:in `block in iterate_until_no_changes'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:270:in `loop'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:270:in `iterate_until_no_changes'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:241:in `do_inspection_loop'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:121:in `block in file_offenses'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:146:in `file_offense_cache'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:120:in `file_offenses'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:111:in `process_file'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:90:in `block in each_inspected_file'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:89:in `each'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:89:in `reduce'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:89:in `each_inspected_file'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:78:in `inspect_files'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/runner.rb:39:in `run'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/cli/command/execute_runner.rb:21:in `execute_runner'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/cli/command/execute_runner.rb:13:in `run'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/cli/command.rb:10:in `run'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/cli/environment.rb:17:in `run'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/cli.rb:65:in `run_command'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/cli.rb:72:in `execute_runners'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/lib/rubocop/cli.rb:41:in `run'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/exe/rubocop:13:in `block in <top (required)>'
/home/khiav/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/khiav/.rvm/gems/ruby-2.5.5/gems/rubocop-0.89.1/exe/rubocop:12:in `<top (required)>'
/home/khiav/.rvm/gems/ruby-2.5.5/bin/rubocop:23:in `load'
/home/khiav/.rvm/gems/ruby-2.5.5/bin/rubocop:23:in `<main>'
/home/khiav/.rvm/gems/ruby-2.5.5/bin/ruby_executable_hooks:24:in `eval'
/home/khiav/.rvm/gems/ruby-2.5.5/bin/ruby_executable_hooks:24:in `<main>'

RuboCop version

$ [bundle exec] rubocop -V
0.89.1 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.5.5 x86_64-linux)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant