com.puppycrawl.tools.checkstyle.checks.metrics

Class JavaNCSSCheck

Implemented Interfaces:
Configurable, Contextualizable

public class JavaNCSSCheck
extends Check

This check calculates the Non Commenting Source Statements (NCSS) metric for java source files and methods. The check adheres to the JavaNCSS specification and gives the same results as the JavaNCSS tool. The NCSS-metric tries to determine complexity of methods, classes and files by counting the non commenting lines. Roughly said this is (nearly) equivalent to counting the semicolons and opening curly braces.
Author:
Lars K?dderitzsch

Method Summary

void
beginTree(DetailAST aRootAST)
void
finishTree(DetailAST aRootAST)
int[]
getDefaultTokens()
int[]
getRequiredTokens()
void
leaveToken(DetailAST aAST)
void
setClassMaximum(int aClassMax)
Sets the maximum ncss for a class.
void
setFileMaximum(int aFileMax)
Sets the maximum ncss for a file.
void
setMethodMaximum(int aMethodMax)
Sets the maximum ncss for a method.
void
visitToken(DetailAST aAST)

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check

beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter

getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setId, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Method Details

beginTree

public void beginTree(DetailAST aRootAST)
Overrides:
beginTree in interface Check

finishTree

public void finishTree(DetailAST aRootAST)
Overrides:
finishTree in interface Check

getDefaultTokens

public int[] getDefaultTokens()
Overrides:
getDefaultTokens in interface Check

getRequiredTokens

public int[] getRequiredTokens()
Overrides:
getRequiredTokens in interface Check

leaveToken

public void leaveToken(DetailAST aAST)
Overrides:
leaveToken in interface Check

setClassMaximum

public void setClassMaximum(int aClassMax)
Sets the maximum ncss for a class.
Parameters:
aClassMax - the maximum ncss

setFileMaximum

public void setFileMaximum(int aFileMax)
Sets the maximum ncss for a file.
Parameters:
aFileMax - the maximum ncss

setMethodMaximum

public void setMethodMaximum(int aMethodMax)
Sets the maximum ncss for a method.
Parameters:
aMethodMax - the maximum ncss

visitToken

public void visitToken(DetailAST aAST)
Overrides:
visitToken in interface Check