java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.Check
com.puppycrawl.tools.checkstyle.checks.metrics.AbstractComplexityCheck
com.puppycrawl.tools.checkstyle.checks.metrics.CyclomaticComplexityCheck
- All Implemented Interfaces:
- com.puppycrawl.tools.checkstyle.api.Configurable, com.puppycrawl.tools.checkstyle.api.Contextualizable
- public class CyclomaticComplexityCheck
- extends AbstractComplexityCheck
Checks cyclomatic complexity against a specified limit. The complexity is
measured by the number of "if", "while", "do", "for", "?:", "catch",
"switch", "case", "&&" and "||" statements (plus one) in the body of the
member. It is a measure of the minimum number of possible paths through the
source and therefore the number of required tests. Generally 1-4 is
considered good, 5-7 ok, 8-10 consider re-factoring, and 11+ re-factor now!
|
Field Summary |
private static int |
DEFAULT_VALUE
default allowed complexity |
| Fields inherited from class com.puppycrawl.tools.checkstyle.api.Check |
|
| Fields inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean |
|
| Methods inherited from class com.puppycrawl.tools.checkstyle.checks.metrics.AbstractComplexityCheck |
getCurrentValue, getMax, getRequiredTokens, incrementCurrentValue, leaveToken, leaveTokenHook, popValue, pushValue, setCurrentValue, setMax, visitToken |
| Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check |
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_VALUE
private static final int DEFAULT_VALUE
- default allowed complexity
- See Also:
- Constant Field Values
CyclomaticComplexityCheck
public CyclomaticComplexityCheck()
- Create an instance.
getDefaultTokens
public int[] getDefaultTokens()
- null
visitTokenHook
protected final void visitTokenHook(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
- null
- Overrides:
visitTokenHook in class AbstractComplexityCheck
getMessageID
protected final java.lang.String getMessageID()
- null
- Specified by:
getMessageID in class AbstractComplexityCheck