Assignments within conditions are hard to spot and therefore make the code less readable. Moreover it often can be a typo and the comparison (==) was intended instead. Ideally, conditions 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