rspec/rules/S3650/rule.adoc

28 lines
563 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-01-27 13:42:22 +01:00
If a ``++WHERE++`` clause contains a condition which is redundant in the context of the the rest of the clause, then it can be removed. If it is redundant because it does not match the programmer's intent, then it's a bug and the sub-condition should be fixed.
2020-06-30 12:48:39 +02:00
=== Noncompliant code example
2020-06-30 12:48:39 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:48:39 +02:00
----
SELECT name, price
FROM product
WHERE price > 15 -- Noncompliant
AND price < 100 -- Noncompliant
AND price = 50
----
=== Compliant solution
2020-06-30 12:48:39 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:48:39 +02:00
----
SELECT name, price
FROM product
WHERE price = 50
----