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
The way we append strings to array should not be changed. Running corrected code should output Foo-Bar-Baz
Actual behavior
Autocorrect changes the code to use \ instead of << which causes strings to be joined before appending them to the array. Running corrected code outputs FooBarBaz
Steps to reproduce the problem
Autocorrect the code snippet above with rubocop -a
Unfortunately we can't know what type a variable dereferences to at runtime using static analysis. What we can do is mark this auto-correction as unsafe in the configuration.
When using
<<
to append multiple string to array,Style/LineEndConcatenation
suggests using\
to join the strings together.Expected behavior
The way we append strings to array should not be changed. Running corrected code should output
Foo-Bar-Baz
Actual behavior
Autocorrect changes the code to use
\
instead of<<
which causes strings to be joined before appending them to the array. Running corrected code outputsFooBarBaz
Steps to reproduce the problem
Autocorrect the code snippet above with
rubocop -a
RuboCop version
The text was updated successfully, but these errors were encountered: