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 have a unit test where the expected value is a squiggly heredoc with a leading space like so:
assert_equal(<<~TXT.chomp,segments.last)\ very long string that has a leading spaceTXT
The Style/RedundantStringEscape cop flags the escaped leading space, and wants to autocorrect it to remove the escape. The Layout/HeredocIndentation cop then wants to remove the space, resulting in a non-equivalent string.
I tried to use an interpolated string literal (#{' '}very long string...) but this is flagged by Lint/LiteralInInterpolation.
I know there are various other contortions I could try to build the desired string, but that seems like it shouldn't be necessary.
Expected behavior
The Style/RedundantStringEscape shouldn't flag an escape necessary for the meaning of the string, and shouldn't remove it as an autofix.
Actual behavior
Style/RedundantStringEscape will in some cases flag an escape that is necessary for the meaning of the string, and will remove it as an autofix.
Steps to reproduce the problem
Write a squiggly heredoc containing a leading escaped whitespace character.
I have a unit test where the expected value is a squiggly heredoc with a leading space like so:
The Style/RedundantStringEscape cop flags the escaped leading space, and wants to autocorrect it to remove the escape. The Layout/HeredocIndentation cop then wants to remove the space, resulting in a non-equivalent string.
I tried to use an interpolated string literal (
#{' '}very long string...
) but this is flagged by Lint/LiteralInInterpolation.I know there are various other contortions I could try to build the desired string, but that seems like it shouldn't be necessary.
Expected behavior
The Style/RedundantStringEscape shouldn't flag an escape necessary for the meaning of the string, and shouldn't remove it as an autofix.
Actual behavior
Style/RedundantStringEscape will in some cases flag an escape that is necessary for the meaning of the string, and will remove it as an autofix.
Steps to reproduce the problem
Write a squiggly heredoc containing a leading escaped whitespace character.
RuboCop version
The text was updated successfully, but these errors were encountered: