Assignments within sub-expressions are hard to spot and therefore make the code less readable. Ideally, sub-expressions should not have side-effects.

Noncompliant Code Example

if (val = value() && check()) { // Noncompliant
  // ...
}

Compliant Solution

val = value();
if (val && check()) {
  // ...
}

Exceptions

The rule does not raise issues for the following patterns:

See