Is there a rule to prefer explicit boolean checks ? #7941
Unanswered
AbdealiLoKo
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a rule in eslint which checks in Typescript when I am using truthy/falsey values - and forces me to provide a better condition.
This encourages people to be more explicit in their condition:
val = 0; if(val)
should be changed to:val = 0; if(val !== null)
I was wondering if there is something similar in
ruff
?I am one of those people who prefers
if val is None:
instead ofif not val:
:)The closest rule I have seen when I searched around was: https://docs.astral.sh/ruff/rules/compare-to-empty-string/
Beta Was this translation helpful? Give feedback.
All reactions