public final class ExecutableStatementCountCheck extends AbstractCheck
Restricts the number of executable statements to a specified limit.
max
- Specify the maximum threshold allowed.
Type is int
.
Default value is 30
.
tokens
- tokens to check
Type is int[]
.
Default value is:
CTOR_DEF,
METHOD_DEF,
INSTANCE_INIT,
STATIC_INIT.
To configure the check:
<module name="ExecutableStatementCount"/>
To configure the check with a threshold of 20 for constructor and method definitions:
<module name="ExecutableStatementCount"> <property name="max" value="20"/> <property name="tokens" value="CTOR_DEF,METHOD_DEF"/> </module>
Parent is com.puppycrawl.tools.checkstyle.TreeWalker
Violation Message Keys:
executableStatementCount
AutomaticBean.OutputStreamOptions
Modifier and Type | Field and Description |
---|---|
static String |
MSG_KEY
A key is pointing to the warning message text in "messages.properties"
file.
|
Constructor and Description |
---|
ExecutableStatementCountCheck()
Constructs a
ExecutableStatementCountCheck . |
Modifier and Type | Method and Description |
---|---|
void |
beginTree(DetailAST rootAST)
Called before the starting to process a tree.
|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
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 to specify the maximum threshold allowed.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
clearMessages, destroy, finishTree, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, log, setFileContents, setTabWidth, setTokens
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
configure, contextualize, getConfiguration, setupChild
public static final String MSG_KEY
public ExecutableStatementCountCheck()
ExecutableStatementCountCheck
.public int[] getDefaultTokens()
AbstractCheck
getDefaultTokens
in class AbstractCheck
TokenTypes
public int[] getRequiredTokens()
AbstractCheck
getRequiredTokens
in class AbstractCheck
TokenTypes
public int[] getAcceptableTokens()
AbstractCheck
getAcceptableTokens
in class AbstractCheck
TokenTypes
public void setMax(int max)
max
- the maximum threshold.public void beginTree(DetailAST rootAST)
AbstractCheck
beginTree
in class AbstractCheck
rootAST
- the root of the treepublic void visitToken(DetailAST ast)
AbstractCheck
visitToken
in class AbstractCheck
ast
- the token to processpublic void leaveToken(DetailAST ast)
AbstractCheck
leaveToken
in class AbstractCheck
ast
- the token leavingCopyright © 2001–2020. All rights reserved.