Groovy Documentation

groovy.org.codenarc.rule.formatting
[Groovy] Class BracesForTryCatchFinallyRule

java.lang.Object
  org.codenarc.rule.AbstractAstVisitorRule
      groovy.org.codenarc.rule.formatting.BracesForTryCatchFinallyRule

class BracesForTryCatchFinallyRule
extends AbstractAstVisitorRule

Checks the location of the opening brace ({) for try statements, the location of the 'catch' keyword and corresponding opening braces, and the location of the 'finally' keyword and the corresponding opening braces. By default, requires opening braces on the same line, but the sameLine property can be set to false to override this. By default does not validate catch and finally clauses, to turn this on set properties validateCatch and validateFinally to true respectively. The catch and finally handling defaults to using the sameLine value so if sameLine is true, we expect "} catch(x) {" and "} finally {". For fine grained control, use boolean properties catchOnSameLineAsClosingBrace, catchOnSameLineAsOpeningBrace, finallyOnSameLineAsClosingBrace, finallyOnSameLineAsOpeningBrace

Authors:
Geli Crick
Hamlet D'Arcy
Matias Bjarland


Property Summary
Class astVisitorClass

Boolean catchOnSameLineAsClosingBrace

Boolean catchOnSameLineAsOpeningBrace

Boolean finallyOnSameLineAsClosingBrace

Boolean finallyOnSameLineAsOpeningBrace

String name

int priority

boolean sameLine

boolean validateCatch

boolean validateFinally

 

Property Detail

astVisitorClass

Class astVisitorClass


catchOnSameLineAsClosingBrace

Boolean catchOnSameLineAsClosingBrace


catchOnSameLineAsOpeningBrace

Boolean catchOnSameLineAsOpeningBrace


finallyOnSameLineAsClosingBrace

Boolean finallyOnSameLineAsClosingBrace


finallyOnSameLineAsOpeningBrace

Boolean finallyOnSameLineAsOpeningBrace


name

String name


priority

int priority


sameLine

boolean sameLine


validateCatch

boolean validateCatch


validateFinally

boolean validateFinally


 

Groovy Documentation