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/SpaceAroundOperators
This PR fixes a false positive for `Layout/SpaceAroundOperators` when match operators between `<<` and `+=`. This change makes the following behavior consistent: ## before Does not register an offense when aligned between `<<`. ```consle % cat example.rb # It does not register an offense. x << foo yz << bar ``` An offense is registered when either is updated to `+=`. ```console % cat example.rb # It does not register an offense. x << foo yz += bar % bundle exec rubocop --only Layout/SpaceAroundOperators (snip) example.rb:2:4: C: [Correctable] Layout/SpaceAroundOperators: Operator << should be surrounded by a single space. x << foo ^^ 1 file inspected, 1 offense detected, 1 offense auto-correctable ``` ## After Both does not register an offense.
- Loading branch information
Showing
3 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
changelog/fix_false_positive_for_layout_space_around_operators.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 @@ | ||
* [#10054](https://github.com/rubocop/rubocop/pull/10054): Fix a false positive for `Layout/SpaceAroundOperators` when match operators between `<<` and `+=`. ([@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