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

org.sonar.l10n.squidjava.rules.squid.S1145.html Maven / Gradle / Ivy

If statements with conditions that are always either true or false are not required, and make the code less readable.

The following code:

public void myMethod() {
  if (true) {                   // Non-Compliant
    doSomething();
  }
}

should be refactored into:

public void myMethod() {
  doSomething();                // Compliant
}

and the following code:

public void myMethod() {
  if (false) {                  // Non-Compliant
    doSomething();
  }
}

should be refactored into:

public void myMethod() {        // Compliant
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy