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 you run auto-correct for Style/MultilineArrayBraceLayout on code with arrays containing trailing comma's, the output code contains errors.
Steps to reproduce the problem
$ cat > test.rb << EOF
# encoding: utf-8
# frozen_string_literal: true
class Test
def test
[a, # a
b, # b
]
end
end
EOF
$ bundle exec rubocop test.rb
Inspecting 1 file
C
Offenses:
test.rb:5:5: C: Closing array brace must be on the same line as the last array element when opening brace is on the same line as the first array element.
[a, # a ...
^^^^^^^
1 file inspected, 1 offense detected
$ bundle exec rubocop --auto-correct test.rb
Inspecting 1 file
E
Offenses:
test.rb:5:5: C: [Corrected] Closing array brace must be on the same line as the last array element when opening brace is on the same line as the first array element.
[a, # a ...
^^^^^^^
test.rb:6:8: E: unexpected token tCOMMA
(Using Ruby 1.9 parser; configure using TargetRubyVersion parameter, under AllCops)
b], # b
^
1 file inspected, 2 offenses detected, 1 offense corrected
$ cat test.rb
# encoding: utf-8
# frozen_string_literal: true
class Test
def test
[a, # a
b], # b
end
end
When you run auto-correct for Style/MultilineArrayBraceLayout on code with arrays containing trailing comma's, the output code contains errors.
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: