-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 negative for
Style/OperatorMethodCall
This PR fixes a false negative for `Style/OperatorMethodCall` when using `a.+ b.something`. The following is the difference depending on whether there is the dot or not. It is the same when the argument is not enclosed in parentheses: ```console % ruby-parse -e "a.+ b.something" (send (send nil :a) :+ (send (send nil :b) :something)) % ruby-parse -e "a + b.something" (send (send nil :a) :+ (send (send nil :b) :something)) ``` It is different when the argument is enclosed in parentheses. ```console % ruby-parse -e "a.+(b).something" (send (send (send nil :a) :+ (send nil :b)) :something) % ruby-parse -e "a +(b).something" (send nil :a (send (send (begin (send nil :b)) :something) :+@)) ``` So the former should be warned by this cop.
- Loading branch information
Showing
3 changed files
with
19 additions
and
3 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
changelog/fix_a_false_negative_for_style_operator_method_call.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 @@ | ||
* [#11379](https://github.com/rubocop/rubocop/pull/11379): Fix a false negative for `Style/OperatorMethodCall` when using `a.+ b.something`. ([@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