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/SpaceInsideBlockBraces infinite loop, but corrected everything? #10958

Closed
ioquatix opened this issue Aug 24, 2022 · 1 comment · Fixed by #10959
Closed

Layout/SpaceInsideBlockBraces infinite loop, but corrected everything? #10958

ioquatix opened this issue Aug 24, 2022 · 1 comment · Fixed by #10959
Labels

Comments

@ioquatix
Copy link

Using the following configuration:

AllCops:
  DisabledByDefault: true

Layout/SpaceInsideBlockBraces:
  Enabled: true
  EnforcedStyle: no_space

On this project: https://github.com/socketry/async-http-cache

results in an infinite loop for what looks like relatively benign code:

11 files inspected, 8 offenses detected, 8 offenses corrected
Infinite loop detected in /home/samuel/Projects/socketry/async-http-cache/spec/async/http/cache/general_spec.rb and caused by Layout/SpaceInsideBlockBraces -> Layout/SpaceInsideBlockBraces
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:300:in `check_for_infinite_loop'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:283:in `block in iterate_until_no_changes'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:282:in `loop'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:282:in `iterate_until_no_changes'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:251:in `do_inspection_loop'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:134:in `block in file_offenses'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:159:in `file_offense_cache'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:133:in `file_offenses'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:124:in `process_file'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:105:in `block in each_inspected_file'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:104:in `each'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:104:in `reduce'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:104:in `each_inspected_file'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:90:in `inspect_files'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/runner.rb:47:in `run'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli/command.rb:11:in `run'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli/environment.rb:18:in `run'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli.rb:72:in `run_command'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli.rb:79:in `execute_runners'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/lib/rubocop/cli.rb:48:in `run'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/exe/rubocop:19:in `block in <top (required)>'
/home/samuel/.rubies/ruby-3.1.2/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'
/home/samuel/.gem/ruby/3.1.2/gems/rubocop-1.35.0/exe/rubocop:19:in `<top (required)>'
/home/samuel/.gem/ruby/3.1.2/bin/rubocop:25:in `load'
/home/samuel/.gem/ruby/3.1.2/bin/rubocop:25:in `<main>'

Branch for repro: https://github.com/socketry/async-http-cache/tree/rubocop

Let me know if I can help further.

@Drenmi Drenmi added the bug label Aug 24, 2022
ydah added a commit to ydah/rubocop that referenced this issue Aug 26, 2022
…Braces` when `EnforcedStyle` is `no_space` and using multiline block

Fix: rubocop#10958
koic added a commit that referenced this issue Aug 26, 2022
[Fix #10958] Fix an infinite loop for `Layout/SpaceInsideBlockBraces` when multiline block
@ioquatix
Copy link
Author

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants