ACR Rules

⌘K
  1. Home
  2. Docs
  3. ACR Rules
  4. Reliability (41)
  5. Identical expressions should not be used on both sides of a binary operator

Identical expressions should not be used on both sides of a binary operator

Introduced in version: 1.3 (29 Jan 2020)

Using the same value on either side of a binary operator is almost always a mistake.

In the case of logical operators (and/or), it is either a copy/paste error and therefore a bug, or it is simply wasted code and should be simplified.

In the case of most binary mathematical operators (-/:/div/mod), having the same value on both sides of an operator yields predictable results, and should be simplified. Plus and multiply operators are excluded from this check.

Noncompliant example:

if $Variable1 != empty and $Variable1 != empty

Compliant example:

if $Variable1 != empty and $Variable2 != empty