-
-
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 a false positive for
Layout/RedundantLineBreak
This PR fixes false positive for `Layout/RedundantLineBreak` to prevent the following infinite loop error: ```console $ echo 'x def self.y; z end' | be rubocop --stdin example.rb -a --only Layout/RedundantLineBreak,Style/SingleLineMethods Inspecting 1 file C Offenses: example.rb:1:1: C: [Corrected] Layout/RedundantLineBreak: Redundant line break detected. x def self.y; ... ^^^^^^^^^^^^^^ example.rb:1:3: C: [Corrected] Style/SingleLineMethods: Avoid single-line method definitions. x def self.y; z end ^^^^^^^^^^^^^^^^^ 0 files inspected, 2 offenses detected, 2 offenses corrected Infinite loop detected in /Users/koic/src/github.com/rubocop/rubocop/example.rb and caused by Style/SingleLineMethods -> Layout/RedundantLineBreak /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/runner.rb:332:in `check_for_infinite_loop' ```
- Loading branch information
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
changelog/fix_a_false_positive_for_layout_redundant_line_break.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 @@ | ||
* [#12155](https://github.com/rubocop/rubocop/pull/12155): Fix false positive for `Layout/RedundantLineBreak` when using a modified singleton method definition. ([@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