Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #9945] Fix heredoc indentation in trailing space corrections #9950

Merged
merged 1 commit into from Jul 24, 2021

Conversation

jonas054
Copy link
Collaborator

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 in Layout/TrailingWhitespace. If both these cops are enabled, Layout/TrailingWhitespace will clean up after Layout/HeredocIndentation to make the code both readable and correct.

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.
@jonas054 jonas054 requested a review from marcandre July 24, 2021 06:57
Copy link
Contributor

@marcandre marcandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@koic koic merged commit b5f3438 into rubocop:master Jul 24, 2021
@koic
Copy link
Member

koic commented Jul 24, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants