Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix #10375] Defer auto-correction of nested unless/else
An unless/else nested inside another unless/else would cause rewrite clobbering when auto-correcting both offenses. By ignoring the node after correcting it and skipping auto-correction for inner nodes with the same offense, we avoid this problem. The auto-correct loop will pick up the remaining offense and fix it. No test case is added for this particular aspect, but it's standard RuboCop behavior.
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 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 @@ | ||
* [#10375](https://github.com/rubocop/rubocop/pull/10375): Fix error for auto-correction of `unless`/`else` nested inside each other. ([@jonas054][]) |
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