rspec/rules/S3403/python/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

34 lines
954 B
Plaintext

== Why is this an issue?
Operators https://docs.python.org/3/reference/expressions.html#is-not[``++is++``] and https://docs.python.org/3/reference/expressions.html#is-not[``++is not++``] check if their operands point to the same instance, thus they will always return respectively True and False when they are used to compare objects of different type. Such comparisons can only be bugs.
=== Noncompliant code example
[source,python]
----
myint = 1
mystring = "1"
value = myint is mystring # Noncompliant. Always False
value = myint is not mystring # Noncompliant. Always True
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this ["is"|"is not"] check between types X and Y; it will always be [False|True].
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]