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

org.sonar.l10n.java.rules.squid.RightCurlyBraceSameLineAsNextBlockCheck.html Maven / Gradle / Ivy

Sharing some coding conventions is a key point to make it possible for a team to efficiently collaborate. This rule make it mandatory to place closing curly braces on the same line that next else, catch or finally keywords.

The following code snippet illustrates this rule:

public void myMethod() {
  if(something) {
    executeTask();
  } else if (somethingElse) {          // Compliant
    doSomethingElse();
  }
  else {                               // Non-Compliant
     generateError();
  }

  try {
    generateOrder();
  } catch (Exception e) {              // Compliant
    log(e);
  }
  finally {                            // Non-Compliant
    closeConnection();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy