-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Style/NumericPredicate broke $CHILD_STATUS == 0
#3892
Comments
Yes. This cop has been known to cause some false positives. The reason being we can't know what type the receiver will be at runtime (since we're doing static code analysis. 😀) We make the assumption that if a receiver is compared with You can disable this for the line affected only using:
or, if this is causing enough false positives that it's not worth it, you can disable it entirely in your
😊 |
For the particular example you posted,
|
We should definitely add a cop for this - it'd be trivial to implement. |
…rison of global variables This cop would suggest replacing numeric comparison with predicate methods for global variables, but due to global variables often being objects that are not entirely polymorphic with `Integer`, this leads to a large amount of false positives. This change fixes that.
Steps to reproduce the problem
Create temp.rb file with
Run
ruby temp.rb #true
Run
rubocop temp.rb
It show warning
If you fix it to
It broke
RuboCop version
The text was updated successfully, but these errors were encountered: