This rule raises an issue when a comparison to
None is invariant.
Why is this an issue?
Checking if a variable or parameter is
None should only be done when you expect that it can be
None. Doing so when the
variable is always
None or never
None is confusing at best. At worse, there is a bug and the variable is not updated
This rule raises an issue when expressions
X is None,
X is not None,
X == None or
X != None are
X is always None or never None.
Noncompliant code example
my_var = None
if my_var == None: # Noncompliant: always True.
if my_var == None: