-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix false positive for
Style/EmptyLineAfterGuardClause
(#5700)
Related #5679. This PR fixes a false positive for Style/EmptyLineAfterGuardClause when guard clause is before `else`. ## Reproduction code ```ruby def foo if cond return another_object if something_different? else bar end end ``` ## Expected behavior No offenses. ## Actual behavior and Steps to reproduce the problem ```console % rubocop /tmp/example.rb --only Style/EmptyLineAfterGuardClause Inspecting 1 file C Offenses: /tmp/example.rb:3:5: C: Style/EmptyLineAfterGuardClause: Add empty line after guard clause. return another_object if something_different? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected ``` ## RuboCop version ```console % rubocop -V 0.53.0 (using Parser 2.5.0.4, running on ruby 2.5.0 x86_64-darwin17) ``` This PR fixes the above false positive.
- Loading branch information
Showing
3 changed files
with
49 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
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