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
This code is valid Ruby, and Ruby respects the whitespace as written. Running the program results in this output:
❯ ruby foo.rb
this is
a string
with some
funky
but valid
whitespace
As such, RuboCop should not flag any offenses.
Actual behavior
RuboCop flags a Layout/RedundantLineBreak offense, and modifies the code. The resulting program behaves differently.
❯ rubocop -a foo.rb
Inspecting 1 file
C
Offenses:
foo.rb:3:1: C: [Corrected] Layout/RedundantLineBreak: Redundant line break detected.
foo = 'this is ...
^^^^^^^^^^^^^^
1 file inspected, 1 offense detected, 1 offense corrected
❯ cat foo.rb
# frozen_string_literal: true
foo = 'this is a string with some funky but valid whitespace '
puts foo
❯ ruby foo.rb
this is a string with some funky but valid whitespace
Layout/RedundantLineBreak
is not respecting multiline strings. Consider this example,foo.rb
:and this rubocop config
.rubocop.yml
:Expected behavior
This code is valid Ruby, and Ruby respects the whitespace as written. Running the program results in this output:
As such, RuboCop should not flag any offenses.
Actual behavior
RuboCop flags a
Layout/RedundantLineBreak
offense, and modifies the code. The resulting program behaves differently.RuboCop version
The text was updated successfully, but these errors were encountered: