rspec/rules/S2259/python/rule.adoc

43 lines
1017 B
Plaintext

A reference to ``++None++`` should never be dereferenced/accessed. Doing so will cause an exception to be thrown. At best, such an exception will cause abrupt program termination. At worst, it could expose debugging information that would be useful to an attacker, or it could allow an attacker to bypass security measures.
== Noncompliant Code Example
----
def myfunc(param):
if param is None:
print(param.test()) # Noncompliant
if param == None:
print(param.test()) # Noncompliant
if param is not None:
pass
else:
print(param.test()) # Noncompliant
if param != None:
pass
else:
print(param.test()) # Noncompliant
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]