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

Layout/SpaceAroundOperators Infinite loop #8751

Closed
hackhowtofaq opened this issue Sep 19, 2020 · 5 comments · Fixed by #11331
Closed

Layout/SpaceAroundOperators Infinite loop #8751

hackhowtofaq opened this issue Sep 19, 2020 · 5 comments · Fixed by #11331

Comments

@hackhowtofaq
Copy link

hackhowtofaq commented Sep 19, 2020

rubocop stderr Infinite loop detected in /tmp/rubocopJQqypL/tmp.rb and caused by Layout/SpaceAroundOperators -> Layout/ExtraSpacing
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:300:in `check_for_infinite_loop'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:283:in `block in iterate_until_no_changes'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:282:in `loop'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:282:in `iterate_until_no_changes'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:251:in `do_inspection_loop'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:128:in `block in file_offenses'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:153:in `file_offense_cache'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:127:in `file_offenses'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:118:in `process_file'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:97:in `block in each_inspected_file'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:96:in `each'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:96:in `reduce'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:96:in `each_inspected_file'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:82:in `inspect_files'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/runner.rb:43:in `run'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/cli/command/execute_runner.rb:17:in 'run'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/cli/command.rb:11:in `run'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/cli/environment.rb:18:in `run'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/cli.rb:65:in `run_command'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/cli.rb:72:in `execute_runners'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/lib/rubocop/cli.rb:41:in `run'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/exe/rubocop:13:in `block in <top (required)>'
.rbenv/versions/2.6.6/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.91.0/exe/rubocop:12:in `<top (required)>'
.rbenv/versions/2.6.6/bin/rubocop:23:in `load'
.rbenv/versions/2.6.6/bin/rubocop:23:in `<main>'

I will try to create a small file demo but I cannot localize the issue in the code right now.

RuboCop version

0.91.0 (using Parser 2.7.1.4, rubocop-ast 0.4.2, running on ruby 2.6.6 x86_64-linux)

Ty!

@marcandre
Copy link
Contributor

A big file is ok too (just create a gist).

@hackhowtofaq
Copy link
Author

I cannot copy the code just like that, sorry.

@dvandersluis
Copy link
Member

dvandersluis commented Oct 3, 2020

@hackhowtofaq can you share your configuration (in .rubocop.yml or other config files) for Layout/SpaceAroundOperators and Layout/ExtraSpacing?

@hackhowtofaq
Copy link
Author

@dvandersluis yeap sure,

.rubocop.yml

inherit_from: .rubocop_todo.yml

require:
  - rubocop-performance
# Rails:
#   Enabled: true

Layout/SpaceAroundOperators

Layout/SpaceAroundOperators:
  Enabled: true

Layout/ExtraSpacing

Layout/ExtraSpacing:
  AllowForAlignment: true
  ForceEqualSignAlignment: true
  Enabled: true

@michaelglass
Copy link

michaelglass commented Dec 7, 2021

here's an example:

Foo.bar(super[3..super.length], baz)

causes

models/foo.rb and caused by Layout/SpaceAroundKeyword -> Layout/SpaceInsideRangeLiteral

default configuration for both

1.23.0 (using Parser 3.0.3.1, rubocop-ast 1.14.0, running on ruby 2.7.5 x86_64-darwin21)
  - rubocop-performance 1.11.1
  - rubocop-rails 2.9.1
  - rubocop-rake 0.5.1
  - rubocop-rspec 2.3.0

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.

4 participants