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
When I run rubocop -a --debug --only Layout/LineLength,Layout/ArgumentAlignment,Layout/HashAlignment test.rb
(obs.: there's also a similar behaviour without the --only argument)
For /Users/Drowze/workspace/ruby-scripts/rubocop_bug2: configuration from /Users/Drowze/workspace/ruby-scripts/rubocop_bug2/.rubocop.yml
Default configuration from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/config/default.yml
Inspecting 1 file
Scanning /Users/Drowze/workspace/ruby-scripts/rubocop_bug2/test.rb
C
Offenses:
test.rb:1:121: C: [Corrected] Layout/LineLength: Line is too long. [133/120]
subject { described_class.(some_argument: 'some_value', some_other_argument: 'some_other_value', another_argument: 'another_value') }
^^^^^^^^^^^^^
test.rb:2:121: C: [Corrected] Layout/LineLength: Line is too long. [124/120]
described_class.(some_argument: 'some_value', some_other_argument: 'some_other_value', another_argument: 'another_value') }
^^^^
test.rb:3:1: C: [Corrected] Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call.
another_argument: 'another_value') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test.rb:3:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line.
another_argument: 'another_value') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test.rb:3:4: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line.
another_argument: 'another_value') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test.rb:3:19: C: [Corrected] Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call.
another_argument: 'another_value') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test.rb:3:22: C: [Corrected] Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call.
another_argument: 'another_value') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test.rb:3:22: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line.
another_argument: 'another_value') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0 files inspected, 8 offenses detected, 8 offenses corrected
Infinite loop detected in /Users/Drowze/workspace/ruby-scripts/rubocop_bug2/test.rb and caused by Layout/HashAlignment -> Layout/ArgumentAlignment
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:299:in `check_for_infinite_loop'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:282:in `block in iterate_until_no_changes'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:281:in `loop'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:281:in `iterate_until_no_changes'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:250:in `do_inspection_loop'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:130:in `block in file_offenses'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:155:in `file_offense_cache'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:129:in `file_offenses'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:120:in `process_file'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:101:in `block in each_inspected_file'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:100:in `each'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:100:in `reduce'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:100:in `each_inspected_file'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:86:in `inspect_files'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/runner.rb:47:in `run'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli/command.rb:11:in `run'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli/environment.rb:18:in `run'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli.rb:65:in `run_command'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/lib/rubocop/cli.rb:41:in `run'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/exe/rubocop:12:in `block in <top (required)>'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/benchmark-0.1.1/lib/benchmark.rb:308:in `realtime'
/Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/exe/rubocop:12:in `<top (required)>'
/Users/Drowze/.asdf/installs/ruby/2.7.3/bin/rubocop:23:in `load'
/Users/Drowze/.asdf/installs/ruby/2.7.3/bin/rubocop:23:in `<main>'
Finished in 0.2556749999639578 seconds
Fixesrubocop#9954.
This PR fixes an infinite loop error for `Layout/HashAlignment` when
`EnforcedStyle: with_fixed_indentation` is specified for `Layout/ArgumentAlignment`.
Fixes#9954.
This PR fixes an infinite loop error for `Layout/HashAlignment` when
`EnforcedStyle: with_fixed_indentation` is specified for `Layout/ArgumentAlignment`.
Expected behavior
I expect Rubocop not to crash.
Actual behavior
When running autocorrection on a specific configuration, Rubocop raises an infinite loop error.
Steps to reproduce the problem
Given
.rubocop.yml
:Given
test.rb
:When I run
rubocop -a --debug --only Layout/LineLength,Layout/ArgumentAlignment,Layout/HashAlignment test.rb
(obs.: there's also a similar behaviour without the
--only
argument)It partially autocorrects the file to:
And I get this output:
RuboCop version
The text was updated successfully, but these errors were encountered: