Why is this an issue?

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.

This rule ignores +, &, *, and **.

How to fix it

Code examples

Noncompliant code example

if a = a then -- always true
  ...
end if;

if a /= a then -- always false
  ...
end if;

if a = b AND a = b then -- if the first one is true, the second one is too
  ...
end if;

if a = b OR a = b then -- if the first one is true, the second one is too
  ...
end if;

j := 5 / 5; -- always 1
k := 5 - 5; -- always 0

Compliant solution

if a = b then
  ...
end if;

if a = b then
  ...
end if;

j := 1;
k := 0;