Fix HEREDOCs in Style/Multiline*BraceLayout Cops #3088
Merged
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.
@jonas054 this relates to a previous Pull Request you made. NOTE: I have not adjusted the comment correction behavior. The tests still exist for that and are not impacted by this change. This only relates to HEREDOC edits that can cause invalid code.
#2873 introduced some changes to HEREDOC handling. While
these changes fixed some issues with auto-correcting and comments, they
also broke the handling of some HEREDOC use-cases.
For example, this code cannot be corrected in the symmetrical or same
line style because
EOM)
on the last line would be invalid code.Additionally, this code cannot be corrected in the symmetrical or same
line style because
<<-EOM).to(<<-EOM2
would not be valid code.This change simply ignores HEREDOCs that cannot be corrected. The
determination is made by checking the HEREDOC's last line.
For example, the following can be corrected because the HEREDOC ends on
a non-conflicting line.