Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix false positive in Style/EvenOdd #7522

Merged
merged 1 commit into from Nov 25, 2019
Merged

Fix false positive in Style/EvenOdd #7522

merged 1 commit into from Nov 25, 2019

Conversation

buehmann
Copy link
Contributor

n % 2 == 2

is auto-corrected to

n.?

by Style/EvenOdd, which is clearly a mistake.

tmp-numbers.rb:1:1: C: [Corrected] Style/EvenOdd: Replace with Integer#?.
n % 2 == 2
^^^^^^^^^^
tmp-numbers.rb:1:3: E: Lint/Syntax: unexpected token tEH
(Using Ruby 2.3 parser; configure using TargetRubyVersion parameter, under AllCops)
n.?
  ^

I am not sure this unusual edge case warrants an entry in the changelog. Just let me know if I should add one.

Copy link
Collaborator

@Drenmi Drenmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@koic
Copy link
Member

koic commented Nov 25, 2019

I think it would be good to add the test case and the changelog entry.

@buehmann
Copy link
Contributor Author

I think it would be good to add the test case and the changelog entry.

Okay, done!

@koic koic merged commit fd5ea0d into rubocop:master Nov 25, 2019
@koic
Copy link
Member

koic commented Nov 25, 2019

Thanks for the perfectly update!

@buehmann buehmann deleted the even-odd branch November 25, 2019 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants