com.puppycrawl.tools.checkstyle.checks.metrics

Class CyclomaticComplexityCheck

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!

Author: Simon Harris Oliver Burn

Constructor Summary
CyclomaticComplexityCheck()
Create an instance.
Method Summary
int[]getDefaultTokens()
{@inheritDoc}
protected StringgetMessageID()
{@inheritDoc}
protected voidvisitTokenHook(DetailAST aAST)
{@inheritDoc}

Constructor Detail

CyclomaticComplexityCheck

public CyclomaticComplexityCheck()
Create an instance.

Method Detail

getDefaultTokens

public int[] getDefaultTokens()
{@inheritDoc}

getMessageID

protected final String getMessageID()
{@inheritDoc}

visitTokenHook

protected final void visitTokenHook(DetailAST aAST)
{@inheritDoc}