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 ((str = cont.substring(pos1, pos2)) != '') { // Noncompliant
  //...
}

Compliant Solution

str = cont.substring(pos1, pos2);
if (str != '') {
  //...
}

See