All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.javascript.rules.javascript.S1126.html Maven / Gradle / Ivy

There is a newer version: 10.17.0.28100
Show newest version

Return of boolean literal statements wrapped into if-then-else flow should be simplified.

Note that if the result of the expression is not a boolean but for instance an integer, then double negation should be used for proper conversion.

if (expression) {
  return true;
} else {
  return false;
}

or

if (expression) {
  return true;
}
return false;

Compliant Solution

return expression;

or

return !!expression;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy