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

v1.15 Infinite loop caused by Layout/ArgumentAlignment -> Layout/FirstHashElementIndentation #9824

Closed
NatMorcos opened this issue May 25, 2021 · 1 comment

Comments

@NatMorcos
Copy link

Expected behavior

Successful autocorrect

Actual behavior

Infinite loop detected, rubocop exits in error.

Minimum reproducible test case included below

Steps to reproduce the problem

# test_file.rb
# frozen_string_literal: true
assert_equal(
  {
    "data" => {
      "trackerStatus" => {
        "id" => expected_tracker.id.to_s,
      },
    },
  },
  result.to_h
)
$ bundle exec rubocop -A test_file.rb --only Layout/ArgumentAlignment,Layout/FirstHashElementIndentation --debug

For /Users/natmorcos/src/github.com/MyApp: configuration from /Users/natmorcos/src/github.com/MyApp/.rubocop.yml
configuration from /Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-rails-2.10.1/config/default.yml
configuration from /Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-rails-2.10.1/config/default.yml
Default configuration from /Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/config/default.yml
Inheriting configuration from /Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-my-org-2.1.0/rubocop.yml
Inheriting configuration from /Users/natmorcos/src/github.com/MyApp/.rubocop_todo.yml
.rubocop.yml: Layout/LineLength:IgnoredPatterns overrides the same parameter in .rubocop_todo.yml

Inspecting 1 file
Scanning /Users/natmorcos/src/github.com/MyApp/test_file.rb
C

Offenses:

test_file.rb:4:3: C: [Corrected] Layout/FirstHashElementIndentation: Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
  "data" => { ...
  ^^^^^^^^^^^
test_file.rb:4:5: C: [Corrected] Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call.
    "data" => { ...
    ^^^^^^^^^^^

0 files inspected, 2 offenses detected, 2 offenses corrected
Infinite loop detected in /Users/natmorcos/src/github.com/MyApp/test_file.rb and caused by Layout/ArgumentAlignment -> Layout/FirstHashElementIndentation
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:299:in `check_for_infinite_loop'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:282:in `block in iterate_until_no_changes'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:281:in `loop'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:281:in `iterate_until_no_changes'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:250:in `do_inspection_loop'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:130:in `block in file_offenses'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:155:in `file_offense_cache'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:129:in `file_offenses'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:120:in `process_file'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:101:in `block in each_inspected_file'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:100:in `each'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:100:in `reduce'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:100:in `each_inspected_file'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:86:in `inspect_files'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/runner.rb:47:in `run'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli/command.rb:11:in `run'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli/environment.rb:18:in `run'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli.rb:65:in `run_command'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/lib/rubocop/cli.rb:41:in `run'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/exe/rubocop:12:in `block in <top (required)>'
/opt/rubies/2.7.2/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/Users/natmorcos/.gem/ruby/2.7.2/gems/rubocop-1.15.0/exe/rubocop:12:in `<top (required)>'
/Users/natmorcos/.gem/ruby/2.7.2/bin/rubocop:23:in `load'
/Users/natmorcos/.gem/ruby/2.7.2/bin/rubocop:23:in `<top (required)>'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/natmorcos/.gem/ruby/2.7.2/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
/Users/natmorcos/.gem/ruby/2.7.2/bin/bundle:23:in `load'
/Users/natmorcos/.gem/ruby/2.7.2/bin/bundle:23:in `<main>'
Finished in 0.4486390000092797 seconds

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:

$  bundle exec rubocop -V
1.15.0 (using Parser 3.0.1.1, rubocop-ast 1.5.0, running on ruby 2.7.2 x86_64-darwin19)
  - rubocop-rails 2.10.1
@dvandersluis
Copy link
Member

dvandersluis commented May 25, 2021

This was already fixed by #9812! It’ll be released in the next RuboCop release.

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