You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow up rubocop/rubocop#13050.
This PR adds "Bitwise Predicate Methods" rule.
Prefer the use of bitwise predicate methods to bitwise operations involving comparisons.
```ruby
# bad - checks any set bits
(variable & flags).positive?
# good
variable.anybits?(flags)
# bad - checks all set bits
(variable & flags) == flags
# good
variable.allbits?(flags)
# bad - checks no set bits
(variable & flags).zero?
(variable & flags) == 0
# good
variable.nobits?(flags)
```
0 commit comments