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 rubocop#9750] Fix an incorrect auto-correct for `Style/SoleNeste…
…dConditional` Fixes rubocop#9750. This PR fixes an incorrect auto-correct for `Style/SoleNestedConditional` when when using nested `if` within `unless foo == bar`. This patch leaves auto-correction from `(!foo == bar)` to `foo != bar` to `Style/InverseMethods` cop thus simplify its role and implementation. And this PR adds a cli test to prevent unintended auto-correction when using `Style/IfUnlessModifier` together for the patch.
- Loading branch information
Showing
4 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
changelog/fix_an_incorrect_autocorrect_for_style_sole_nested_conditional_cop.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 @@ | ||
* [#9750](https://github.com/rubocop/rubocop/issues/9750): Fix an incorrect auto-correct for `Style/SoleNestedConditional` when when using nested `if` within `unless foo == bar`. ([@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