Hi,
Whilst running rubocop, I came across this situation:
โ puma git:(master) โ rubocop -a
Inspecting 116 files
..........................................................
.....................................................C....
Offenses:
test/test_thread_pool.rb:148:17: C: [Corrected] Style/WhileUntilModifier: Favor modifier
until usage when having a single-line body.
Thread.pass until pool.spawned == 1 ||
^^^^^
test/test_thread_pool.rb:214:17: C: [Corrected] Style/WhileUntilModifier: Favor modifier
until usage when having a single-line body.
Thread.pass until pool.spawned == 0 ||
^^^^^
116 files inspected, 2 offenses detected, 2 offenses corrected
โ puma git:(master) โ git diff
โ puma git:(master) โ rubocop
Inspecting 116 files
..........................................................
.....................................................C....
Offenses:
test/test_thread_pool.rb:148:17: C: Style/WhileUntilModifier: Favor modifier until usage when
having a single-line body.
Thread.pass until pool.spawned == 1 ||
^^^^^
test/test_thread_pool.rb:214:17: C: Style/WhileUntilModifier: Favor modifier until usage when
having a single-line body.
Thread.pass until pool.spawned == 0 ||
^^^^^
116 files inspected, 2 offenses detected
Even though the Style/WhileUntilModifier cop marks it as [Corrected], it still doesn't really auto-correct it.
Perhaps a bug?
Is this with the latest RuboCop?
Hi Marc,
Is this with the latest RuboCop?
Yep, 0.87.1.
I am also getting a "Infinite loop detected" error. You don't have that?
Ah, weird. Initially, I didn't get it, but now I do.
Here's the stacktrace:
``
Infinite loop detected in /home/utkarsh/github/puma/test/test_thread_pool.rb.
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:289:incheck_for_infinite_loop'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:272:in block in iterate_until_no_changes'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:271:inloop'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:271:in iterate_until_no_changes'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:242:indo_inspection_loop'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:122:in block in file_offenses'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:147:infile_offense_cache'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:120:in file_offenses'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:111:inprocess_file'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:90:in block in each_inspected_file'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:89:ineach'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:89:in reduce'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:89:ineach_inspected_file'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:78:in inspect_files'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/runner.rb:39:inrun'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/cli/command/execute_runner.rb:21:in execute_runner'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/cli/command/execute_runner.rb:13:inrun'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/cli/command.rb:10:in run'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/cli/environment.rb:17:inrun'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/cli.rb:65:in run_command'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/cli.rb:72:inexecute_runners'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/lib/rubocop/cli.rb:41:in run'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/exe/rubocop:13:inblock in realtime'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/gems/rubocop-0.87.1/exe/rubocop:12:inload'
/home/utkarsh/.ruby-standalone/gems/ruby/2.7.1/bin/rubocop:23:in
````
Ah, ok. Thanks for the report.
I can confirm this is a false positive and I'll try to fix it.
Great, thanks!
You're the best! :tada:
Took a bit more time than I hoped ๐
A complete spec refactor and three (five, really) bug reports later, it's fixed ๐
Thanks for reporting this bug!
Oh wow, this is awesome!
Thank you! โค๏ธ
Most helpful comment
Took a bit more time than I hoped ๐
A complete spec refactor and three (five, really) bug reports later, it's fixed ๐
Thanks for reporting this bug!