-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
float_cmp: ignore when comparing with constant? #1142
Comments
Hi, was just about to look at this one. Is this still the case at the moment? Correct me if I'm mistaken but it looks like it is already been covered by the lint.
|
This has not been covered yet. I think what @birkenfeld suggests is to not lint if at least one side of the |
I see, thanks for the clarification @oli-obk . Do we also need to check if one side is an expression (e.g. |
As long as one side is a constant. Instead of removing the linting if there are constants, we can add a restriction lint that still triggers. I'm fairly certain someone will want to forbid all float comparisons. |
Fix #1142 float constant comparison lint
Consider:
These are probably cases where you want to check for the exact constant, because it is a common argument, a sentinel value, or an integer converted to floating-point due to external APIs, etc.
There is already a special case for 0 and +/-inf, but I'd add a case for this situation too.
The text was updated successfully, but these errors were encountered: