com.puppycrawl.tools.checkstyle.checks.coding
Class ReturnCountCheck
- Configurable, Contextualizable
public final class ReturnCountCheck
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.
- Simon Harris
TODO: Test for inside a static block
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 |
ReturnCountCheck
public ReturnCountCheck()
Creates new instance of the checks.
beginTree
public void beginTree(DetailAST aRootAST)
- beginTree in interface Check
getDefaultTokens
public int[] getDefaultTokens()
- getDefaultTokens in interface Check
getMax
public int getMax()
Getter for max property.
- maximum allowed number of return statements.
getRequiredTokens
public int[] getRequiredTokens()
- getRequiredTokens in interface Check
leaveToken
public void leaveToken(DetailAST aAST)
- leaveToken in interface Check
setMax
public void setMax(int aMax)
Setter for max property.
aMax
- maximum allowed number of return statements.
visitToken
public void visitToken(DetailAST aAST)
- visitToken in interface Check