45 lines
897 B
Plaintext
Raw Permalink Normal View History

2023-08-07 15:16:04 +02:00
This rule raises an issue when the inequality operator `<>` is used.
== Why is this an issue?
2023-08-07 15:16:04 +02:00
The operators ``++<>++`` and ``++!=++`` are equivalent.
However, the `<>` operator is considered obsolete in Python 2.7 and
has been removed from Python 3. Therefore, it is recommended to use `!=` instead.
2021-04-28 16:49:39 +02:00
2023-08-07 15:16:04 +02:00
=== Code examples
2023-08-07 15:16:04 +02:00
==== Noncompliant code example
2021-04-28 16:49:39 +02:00
2023-08-07 15:16:04 +02:00
[source,python,diff-id=1,diff-type=noncompliant]
2021-04-28 16:49:39 +02:00
----
2023-08-07 15:16:04 +02:00
return a <> b # Noncompliant: the operator "<>" is deprecated.
2021-04-28 16:49:39 +02:00
----
2023-08-07 15:16:04 +02:00
==== Compliant solution
2021-04-28 16:49:39 +02:00
2023-08-07 15:16:04 +02:00
[source,python,diff-id=1,diff-type=compliant]
2021-04-28 16:49:39 +02:00
----
return a != b
----
2023-08-07 15:16:04 +02:00
== Resources
=== Documentation
* Python Documentation: https://docs.python.org/2.7/reference/lexical_analysis.html#operators[Python 2.7 - Operators]
ifdef::env-github,rspecator-view[]
2023-08-07 15:16:04 +02:00
'''
== Implementation Specification
(visible only on this page)
=== Message
Use "!=" instead.
endif::env-github,rspecator-view[]