public class NoCodeInFileCheck extends AbstractCheck
Checks whether file contains code. Files which are considered to have no code:
To configure the check:
<module name="NoCodeInFile"/>
Example:
Content of the files:
// single line comment // violation
/* // violation block comment */
Parent is com.puppycrawl.tools.checkstyle.TreeWalker
Violation Message Keys:
nocode.in.file
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_LINE_NUMBER
Line number used to log violation when no AST nodes are present in file.
|
static java.lang.String |
MSG_KEY_NO_CODE
A key is pointing to the warning message text in "messages.properties"
file.
|
| Constructor and Description |
|---|
NoCodeInFileCheck() |
| Modifier and Type | Method and Description |
|---|---|
void |
finishTree(DetailAST ast)
Called after finished processing a tree.
|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
beginTree, clearViolations, destroy, getFileContents, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokens, visitTokenfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic static final java.lang.String MSG_KEY_NO_CODE
private static final int DEFAULT_LINE_NUMBER
public NoCodeInFileCheck()
public int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic void finishTree(DetailAST ast)
AbstractCheckfinishTree in class AbstractCheckast - the root of the treeCopyright © 2001-2022. All Rights Reserved.