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
I encountered this problem when trying to autocorrect curly braces to do...ends. If the closing braces are right next to each other rubocop will just replace each } with end without inserting any spaces, e.g. }} will become endend.
This is probably easier to demonstrate:
$ rubocop -V
warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.7-compliant syntax, but you are running 2.1.3.
0.33.0 (using Parser 2.3.0.pre.2, running on ruby 2.1.3 x86_64-darwin13.0)
$
$
$
$ cat test.rb
(0..3).each { |a| a.times {
puts a
}}
$
$
$
$ rubocop -a test.rb
warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.7-compliant syntax, but you are running 2.1.3.
Inspecting 1 file
E
Offenses:
test.rb:1:13: C: [Corrected] Avoid using {...} for multi-line blocks.
(0..3).each { |a| a.times {
^
test.rb:1:19: C: [Corrected] Block body expression is on the same line as the block start.
(0..3).each { |a| a.times {
^^^^^^^^^
test.rb:1:27: C: [Corrected] Avoid using {...} for multi-line blocks.
(0..3).each { |a| a.times {
^
test.rb:4:1: E: unexpected token $end
1 file inspected, 4 offenses detected, 3 offenses corrected
$
$
$
$ cat test.rb
(0..3).each do |a| a.times do
puts a
endend
The text was updated successfully, but these errors were encountered:
I encountered this problem when trying to autocorrect curly braces to
do...end
s. If the closing braces are right next to each other rubocop will just replace each}
withend
without inserting any spaces, e.g.}}
will becomeendend
.This is probably easier to demonstrate:
The text was updated successfully, but these errors were encountered: