com.puppycrawl.tools.checkstyle.checks.blocks

Class NeedBracesCheck

Implemented Interfaces:
Configurable, Contextualizable

public class NeedBracesCheck
extends Check

Checks for braces around code blocks.

By default the check will check the following blocks: LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE.

An example of how to configure the check is:

 <module name="NeedBraces"/>
 

An example of how to configure the check for if and else blocks is:

 <module name="NeedBraces">
     <property name="tokens" value="LITERAL_IF, LITERAL_ELSE"/>
 </module>
 

Version:
1.0

Author:
Rick Giles

Method Summary

int[]
getDefaultTokens()
void
visitToken(DetailAST aAST)

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check

beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter

getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Method Details

getDefaultTokens

public int[] getDefaultTokens()
Overrides:
getDefaultTokens in interface Check

See Also:
Check


visitToken

public void visitToken(DetailAST aAST)
Overrides:
visitToken in interface Check

See Also:
Check