-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
Expected behavior
File test.rb
:
h = {very: {deep: {nested: {hash: false}}}}
val = h[:very] \
[:deep] \
[:nested] \
[:hash]
puts val
Running bundle exec rubocop test.rb --only Style/RedundantLineContinuation
does not highlight any errors.
Running ruby test.rb
produces the output false
.
Actual behavior
Running bundle exec rubocop test.rb --debug --only Style/RedundantLineContinuation
produces
C
Offenses:
test.rb:3:16: C: [Correctable] Style/RedundantLineContinuation: Redundant line continuation.
val = h[:very] \ ...
^
test.rb:4:11: C: [Correctable] Style/RedundantLineContinuation: Redundant line continuation.
[:deep] \ ...
^
test.rb:5:13: C: [Correctable] Style/RedundantLineContinuation: Redundant line continuation.
[:nested] \ ...
^
1 file inspected, 3 offenses detected, 3 offenses autocorrectable
Running bundle exec rubocop test.rb --fix --only Style/RedundantLineContinuation
removes the line continuations. After this, running ruby test.rb
outputs:
{:deep=>{:nested=>{:hash=>false}}}
Steps to reproduce the problem
Create a file called test.rb
containing the code from above. Run bundle exec rubocop test.rb --only Style/RedundantLineContinuation
.
RuboCop version
bundle exec rubocop -V
1.59.0 (using Parser 3.3.0.4, rubocop-ast 1.30.0, running on ruby 3.2.2) [arm64-darwin22]
Also:
rubocop _1.60.0_ -V
1.60.0 (using Parser 3.3.0.4, rubocop-ast 1.30.0, running on ruby 3.2.2) [arm64-darwin22]
rubocop _1.60.0_ --only Style/RedundantLineContinuation test.rb
Inspecting 1 file
C
Offenses:
test.rb:3:16: C: [Correctable] Style/RedundantLineContinuation: Redundant line continuation.
val = h[:very] \ ...
^
test.rb:4:11: C: [Correctable] Style/RedundantLineContinuation: Redundant line continuation.
[:deep] \ ...
^
test.rb:5:13: C: [Correctable] Style/RedundantLineContinuation: Redundant line continuation.
[:nested] \ ...
^
1 file inspected, 3 offenses detected, 3 offenses autocorrectable