rspec/rules/S2259/python/rule.adoc

44 lines
1.0 KiB
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01:00
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.
2020-06-30 12:48:07 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,python]
2020-06-30 12:48:07 +02:00
----
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[]