Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an autocorrect for
Style/RedundantSort
with logical operator
This PR is fix an autocorrect for `Style/RedundantSort` with predicate operator If you have a code like the following: ```ruby [1, 2, 3] .sort_by { |x| x.length } .first || [] ``` After autocorrection it will look like this: ```ruby [1, 2, 3] .sort_by { |x| x.length } || [] ``` This is a syntax error. ``` Error: : eval:3: syntax error, unexpected '|', expecting end-of-input || [] ^ (SyntaxError) ```
- Loading branch information
Showing
3 changed files
with
97 additions
and
6 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 @@ | ||
* [#10853](https://github.com/rubocop/rubocop/pull/10853): Fix an autocorrect for `Style/RedundantSort` with logical operator. ([@ydah][]) |
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