应该简化封装在if-then-else中的布尔值。

比如,下列代码:

if (someBooleanMethod()) {    // Non-Compliant
  return true;
} else {
  return false;
}

应该重构为:

return someBooleanMethod();   // Compliant

如下代码:

if (someBooleanMethod()) {    // Non-Compliant
  return false;
} else {
  return true;
}

应该重构为:

return !someBooleanMethod();  // Compliant