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 .. caused by Layout/FirstHashElementIndentation -> Layout/ArgumentAlignment #9826

Closed
jaredbeck opened this issue May 26, 2021 · 2 comments

Comments

@jaredbeck
Copy link
Contributor

jaredbeck commented May 26, 2021

Regression

  • 1.14.0 does not have issue
  • 1.15.0 has issue

Config

  • FirstHashElementIndentation - default settings
Layout/ArgumentAlignment:
  EnforcedStyle: with_fixed_indentation

Expected behavior

rubocop -A should not have infinite loop.

Actual behavior

Infinite loop detected in redacted.rb and caused by Layout/FirstHashElementIndentation -> Layout/ArgumentAlignment
redacted/rubocop/runner.rb:299:in `check_for_infinite_loop'
redacted/rubocop/runner.rb:282:in `block in iterate_until_no_changes'
redacted/rubocop/runner.rb:281:in `loop'
redacted/rubocop/runner.rb:281:in `iterate_until_no_changes'
redacted/rubocop/runner.rb:250:in `do_inspection_loop'
redacted/rubocop/runner.rb:130:in `block in file_offenses'
redacted/rubocop/runner.rb:155:in `file_offense_cache'
redacted/rubocop/runner.rb:129:in `file_offenses'
redacted/rubocop/runner.rb:120:in `process_file'
redacted/rubocop/runner.rb:101:in `block in each_inspected_file'
redacted/rubocop/runner.rb:100:in `each'
redacted/rubocop/runner.rb:100:in `reduce'
redacted/rubocop/runner.rb:100:in `each_inspected_file'
redacted/rubocop/runner.rb:86:in `inspect_files'
redacted/rubocop/runner.rb:47:in `run'

Steps to reproduce the problem

  1. Use the above config
  2. Have a source file with a correctable offense, like the following:
redacted.rb:339:15: C: [Correctable] Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call.
              'redacted' => 'redacted',
              ^^^^^^^^^^^^^^^^^^

For example,

ActionController::Parameters.new(
  {
    'redacted' => 'redacted',
  1. Run bin/rubocop -A
  2. See "Infinite loop detected"

RuboCop version

bin/rubocop -V
1.15.0 (using Parser 3.0.1.1, rubocop-ast 1.6.0, running on ruby 2.7.3 x86_64-darwin20)
  - rubocop-rails 2.10.1
  - rubocop-rspec 2.3.0
@dvandersluis
Copy link
Member

Hi @jaredbeck this is fixed already in #9812, and will be released soon!

@jaredbeck
Copy link
Contributor Author

Thanks @dvandersluis and @koic !

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

No branches or pull requests

2 participants