Assignments within sub-expressions are hard to spot and therefore make the code less readable. Ideally, sub-expressions should not have side-effects.
if ((str = cont.substring(pos1, pos2)) != '') { // Noncompliant
//...
}
str = cont.substring(pos1, pos2);
if (str != '') {
//...
}