Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
AllowComments
option for Style/EmptyElse
This PR is support `AllowComments` option for `Style/EmptyElse`. The default for this option is false. In the case of complex conditional statements, we may want to leave `else` empty or nil and write only the explanation of the `else` case in the comments. `AllowComments: true` will not treat when `else` as offense if the `else` with an intentional comment. ### @example AllowComments: false (default) ```ruby # bad if condition statement else # something comment nil end # bad if condition statement else # something comment end ``` ### @example AllowComments: true ```ruby # good if condition statement else # something comment nil end # good if condition statement else # something comment end ```
- Loading branch information
Showing
4 changed files
with
207 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 @@ | ||
* [#10790](https://github.com/rubocop/rubocop/pull/10790): Support `AllowComments` option for `Style/EmptyElse`. ([@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
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