rspec/rules/S1764/plsql/rule.adoc

31 lines
830 B
Plaintext
Raw Normal View History

2020-06-30 12:47:33 +02:00
Using the same value on either side of a binary operator is almost always a mistake. In the case of logical operators, it is either a copy/paste error and therefore a bug, or it is simply wasted code, and should be simplified.
2021-02-02 15:02:10 +01:00
This rule ignores operators ``+``, ``++*++`` and ``++||++``, and expressions: ``++1=1++``, ``++1<>1++``, ``++1!=1++``, ``++1~=1++`` and ``++1^=1++``.
2020-06-30 12:47:33 +02:00
== Noncompliant Code Example
----
SELECT code
FROM Person
WHERE first_name IS NULL OR first_name IS NULL; -- Noncompliant
SELECT * FROM Users
INNER JOIN Clients ON Clients.id = Clients.id; -- Noncompliant
----
== Compliant Solution
----
SELECT code
FROM Person
WHERE first_name IS NULL OR last_name IS NULL;
SELECT * FROM Users
INNER JOIN Clients ON Clients.id = Users.id;
----
include::../exceptions.adoc[]
include::../see.adoc[]