[Fix #9945] Fix heredoc indentation in trailing space corrections #9950
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Whitespace-only lines within heredocs that are shorter than the indentation level, or equal to it, should be removed when correcting trailing whitespace. Inserting string interpolation tokens on these lines changes the indentation level for squiggly heredocs.
Although I mentioned in #9945 that
Layout/HeredocIndentation
does some unnecessary changes to empty lines within heredocs, I've chosen to only fix the actual bug here, which is inLayout/TrailingWhitespace
. If both these cops are enabled,Layout/TrailingWhitespace
will clean up afterLayout/HeredocIndentation
to make the code both readable and correct.