forked from rubocop/rubocop
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an incorrect auto-correct for
Layout/LineLength
This PR fixes the following incorrect auto-correct for `Layout/LineLength` when a heredoc is used as the first element of an array. ```console % cat example.rb [<<~STRING, { key1: value1, key2: value2 }] STRING % ruby -c example.rb Syntax OK % cat .rubocop.yml Layout/LineLength: Max: 40 % bundle exec rubocop --only Layout/LineLength example.rb -a (snip) Inspecting 1 file C Offenses: example.rb:1:41: C: [Corrected] Layout/LineLength: Line is too long. [43/40] [<<~STRING, { key1: value1, key2: value2 }] ^^^ 1 file inspected, 1 offense detected, 1 offense corrected % cat example.rb [<<~STRING, { key1: value1, key2: value2 }] STRING % ruby -c example.rb example.rb:1: syntax error, unexpected end-of-input, expecting ']' ```
- Loading branch information
1 parent
1988062
commit 5129edd
Showing
3 changed files
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#9938](https://github.com/rubocop/rubocop/pull/9938): Fix an incorrect auto-correct for `Layout/LineLength` when a heredoc is used as the first element of an array. ([@koic][]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters