Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a false positive for
Layout/SingleLineBlockChain
This PR fixes the following incorrect auto-correct for `Layout/SingleLineBlockChain` when method call chained on a new line after a single line block with trailing dot. It also fixes the following incorrect auto-correction between `Layout/SingleLineBlockChain` and `Layout/DotPosition` cops. ```console % cat example.rb example.select { |item| item.cond? }. join('-') % ruby -c example.rb Syntax OK % bundle exec rubocop -a --only Layout/DotPosition,Layout/SingleLineBlockChain example.rb % cat example.rb example.select { |item| item.cond? } .join('-') % ruby -c example.rb example.rb:3: syntax error, unexpected '.', expecting end-of-input .join('-') ```
- Loading branch information
Showing
4 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
changelog/fix_a_false_positive_for_layout_single_line_block_chain.md
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 @@ | ||
* [#10063](https://github.com/rubocop/rubocop/pull/10063): Fix a false positive for `Layout/SingleLineBlockChain` when method call chained on a new line after a single line block with trailing dot. ([@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
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