Right curly braces should be located at the beginning of lines of code

  • squid : RightCurlyBraceStartLineCheck

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 right curly braces at the beginning of lines of code.

The following code snippet illustrates this rule:

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

  try {
    generateOrder();
  } finally {                         // Compliant
    closeConnection();
  }                                   // Compliant

  try {
    generateOrder();
  } finally {                         // Compliant
    closeConnection(); }              // Non-Compliant
}
Close