-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 positives for use-implicit-booleaness-not-comparison
checks
#10246
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #10246 +/- ##
=======================================
Coverage 95.85% 95.86%
=======================================
Files 175 175
Lines 19056 19058 +2
=======================================
+ Hits 18267 18269 +2
Misses 789 789
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a changelog? Rest of the changes LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks great, the primer looks amazing (I realized that we had a bug in the message for some chained comparisons they were not displayed in full but now it's gone, so.. good)
π€ Effect of this PR on checked open source code: π€ Effect on django:
Effect on pandas:
Effect on sentry:
This comment was generated for commit 187e34f |
Type of Changes
Description
Currently, the
use-implicit-booleaness-not-comparison
check is applied to expressions with chained comparison. The emitted message and suggested code correction seem inaccurate, and I can't seem to find existing functional tests indicating that this behavior is intended. Therefore, these changes will skip the check when chained comparison nodes are visited.Take for example:
foo != bar == []
is equivalent tofoo != bar and bar == []
, which is not the same asnot foo
.Similar for
use-implicit-booleaness-not-comparison-to-zero
anduse-implicit-booleaness-not-comparison-to-string
.Closes #10065