Skip to content

Commit

Permalink
Fix false positive in Style/EvenOdd
Browse files Browse the repository at this point in the history
  • Loading branch information
buehmann committed Nov 25, 2019
1 parent d9f42c8 commit 6ce6c8e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 2 additions & 4 deletions CHANGELOG.md
Expand Up @@ -8,17 +8,15 @@
* [#7509](https://github.com/rubocop-hq/rubocop/issues/7509): Fix `Layout/SpaceInsideArrayLiteralBrackets` to correct empty lines. ([@ayacai115][])
* [#7517](https://github.com/rubocop-hq/rubocop/issues/7517): `Style/SpaceAroundKeyword` allows `::` after `super`. ([@ozydingo][])
* [#7515](https://github.com/rubocop-hq/rubocop/issues/7515): Fix a false negative for `Style/RedundantParentheses` when calling a method with safe navigation operator. ([@koic][])
* [#7477](https://github.com/rubocop-hq/rubocop/issues/7477): Fix line length autocorrect for semicolons in string literals. ([@maxh][])
* [#7522](https://github.com/rubocop-hq/rubocop/pull/7522): Fix a false-positive edge case (`n % 2 == 2`) for `Style/EvenOdd`. ([@buehmann][])

### Changes

* [#7077](https://github.com/rubocop-hq/rubocop/issues/7077): **(Breaking)** Further standardisation of cop names. ([@scottmatthewman][])
* [#7469](https://github.com/rubocop-hq/rubocop/pull/7469): **(Breaking)** Replace usages of the terms `Whitelist` and `Blacklist` with better alternatives. ([@koic][])
* [#7502](https://github.com/rubocop-hq/rubocop/pull/7502): Remove `SafeMode` module. ([@koic][])

### Bug fixes

* [#7477](https://github.com/rubocop-hq/rubocop/issues/7477): Fix line length autocorrect for semicolons in string literals. ([@maxh][])

## 0.76.0 (2019-10-28)

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/even_odd.rb
Expand Up @@ -23,7 +23,7 @@ class EvenOdd < Cop
{(send $_ :% (int 2))
(begin (send $_ :% (int 2)))}
${:== :!=}
(int ${0 1 2}))
(int ${0 1}))
PATTERN

def on_send(node)
Expand Down
4 changes: 4 additions & 0 deletions spec/rubocop/cop/style/even_odd_spec.rb
Expand Up @@ -73,6 +73,10 @@
RUBY
end

it 'accepts x % 2 == 2' do
expect_no_offenses('x % 2 == 2')
end

it 'accepts x % 3 == 0' do
expect_no_offenses('x % 3 == 0')
end
Expand Down

0 comments on commit 6ce6c8e

Please sign in to comment.