com.puppycrawl.tools.checkstyle.checks.metrics
Class AbstractComplexityCheck
- Configurable, Contextualizable
public abstract class AbstractComplexityCheck
Base class for checks the calculate complexity based around methods.
- Simon Harris
- Oliver Burn
beginTree , destroy , finishTree , getAcceptableTokens , getClassLoader , getDefaultTokens , getFileContents , getLines , getRequiredTokens , getTabWidth , getTokenNames , init , leaveToken , log , log , setClassLoader , setFileContents , setMessages , setTabWidth , setTokens , visitToken |
getMessageBundle , getSeverity , getSeverityLevel , log , log , log , log , log , log , log , log , log , log , log , setSeverity |
AbstractComplexityCheck
public AbstractComplexityCheck(int aMax)
Creates an instance.
aMax
- the threshold of when to report an error
getCurrentValue
protected final int getCurrentValue()
- the current value
getMax
public final int getMax()
- the maximum threshold allowed
getMessageID
protected String getMessageID()
- the message ID to log violations with
getRequiredTokens
public final int[] getRequiredTokens()
- getRequiredTokens in interface Check
incrementCurrentValue
protected final void incrementCurrentValue(int aBy)
Increments the current value by a specified amount.
aBy
- the amount to increment by
leaveToken
public void leaveToken(DetailAST aAST)
- leaveToken in interface Check
leaveTokenHook
protected void leaveTokenHook(DetailAST aAST)
Hook called when leaving a token. Will not be called the method
definition tokens.
aAST
- the token being left
popValue
protected final int popValue()
- pop a value off the stack and make it the current value
pushValue
protected final void pushValue()
Push the current value on the stack
setCurrentValue
protected final void setCurrentValue(int aValue)
Set the current value
aValue
- the new value
setMax
public final void setMax(int aMax)
Set the maximum threshold allowed.
aMax
- the maximum threshold
visitToken
public void visitToken(DetailAST aAST)
- visitToken in interface Check
visitTokenHook
protected void visitTokenHook(DetailAST aAST)
Hook called when visiting a token. Will not be called the method
definition tokens.
aAST
- the token being visited