Skip to content

Commit

Permalink
Recognise < > as comparison operators in cond assign
Browse files Browse the repository at this point in the history
  • Loading branch information
biinari committed Aug 8, 2020
1 parent cc89ca0 commit 1e4c878
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,10 @@
* [#8480](https://github.com/rubocop-hq/rubocop/issues/8480): Tweak callback list of `Lint/MissingSuper`. ([@marcandre][])
* [#8481](https://github.com/rubocop-hq/rubocop/pull/8481): Fix autocorrect for elements with newlines in `Style/SymbolArray` and `Style/WordArray`. ([@biinari][])

### Changes

* [#8487](https://github.com/rubocop-hq/rubocop/pull/8487): Detect `<` and `>` as comparison operators in `Style/ConditionalAssignment` cop. ([@biinari][])

## 0.89.0 (2020-08-05)

### New features
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/conditional_assignment.rb
Expand Up @@ -233,7 +233,7 @@ class ConditionalAssignment < Cop
def_node_matcher :assignment_type?, <<~PATTERN
{
#{ASSIGNMENT_TYPES.join(' ')}
(send _recv {:[]= :<< :=~ :!~ :<=> #end_with_eq?} ...)
(send _recv {:[]= :<< :=~ :!~ :<=> #end_with_eq? :< :>} ...)
}
PATTERN

Expand Down
Expand Up @@ -282,6 +282,8 @@
it_behaves_like('comparison methods', '===')
it_behaves_like('comparison methods', '<=')
it_behaves_like('comparison methods', '>=')
it_behaves_like('comparison methods', '<')
it_behaves_like('comparison methods', '>')

context 'empty branch' do
it 'allows an empty if statement' do
Expand Down

0 comments on commit 1e4c878

Please sign in to comment.