0

While working on a project I need to format my Java code in a specific manner. If it is not formatted in correct way, the build will create problems:

Correct way:

public static void main(String[] args)
{
  // Code
}

Incorrect way: //Check the braces

public static void main (String[] args) {
  //code
}

Does any one know for this purpose, which checkstyle should be used/configured in Eclipse?

1 Answers1

1

which checkstyle should be used/configured in Eclipse?

The checkstyle rule LeftCurly defines the placement of left curly braces:

  • eol: The brace must always be on the end of the line.
  • nl: The brace must always be on a new line.
  • nlow: Apply either eol or nl depending on the length of the line.

See also the LeftCurly rule in the Block Checks category and the Lcurly property.

Andreas Fester
  • 36,091
  • 7
  • 95
  • 123