public final class ReturnCountCheck extends AbstractFormatCheck
Restricts return statements to a specified count (default = 2).
Ignores specified methods (equals()
by default).
Rationale: Too many return points can be indication that code is attempting to do too much or may be difficult to understand.
Constructor and Description |
---|
ReturnCountCheck()
Creates new instance of the checks.
|
Modifier and Type | Method and Description |
---|---|
void |
beginTree(DetailAST rootAST)
Called before the starting to process a tree.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int |
getMax()
Getter for max property.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
leaveToken(DetailAST ast)
Called after all the child nodes have been process.
|
void |
setMax(int max)
Setter for max property.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
getFormat, getRegexp, setCompileFlags, setFormat
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLine, getLines, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public ReturnCountCheck()
public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
public int[] getRequiredTokens()
Check
getRequiredTokens
in class Check
TokenTypes
public int getMax()
public void setMax(int max)
max
- maximum allowed number of return statements.public void beginTree(DetailAST rootAST)
Check
public void visitToken(DetailAST ast)
Check
visitToken
in class Check
ast
- the token to processpublic void leaveToken(DetailAST ast)
Check
leaveToken
in class Check
ast
- the token leavingCopyright © 2001–2015. All rights reserved.