Class MultipleVariableDeclarationsExtendedCheck
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
-
- com.puppycrawl.tools.checkstyle.api.AbstractCheck
-
- com.github.sevntu.checkstyle.checks.coding.MultipleVariableDeclarationsExtendedCheck
-
- All Implemented Interfaces:
com.puppycrawl.tools.checkstyle.api.Configurable
,com.puppycrawl.tools.checkstyle.api.Contextualizable
public class MultipleVariableDeclarationsExtendedCheck extends com.puppycrawl.tools.checkstyle.api.AbstractCheck
Checks that each variable declaration is in its own statement and on its own line.
Rationale: the SUN Code conventions chapter 6.1 recommends that declarations should be one per line.
An example of how to configure the check is:
<module name="MultipleVariableDeclarations"/>
- Since:
- 1.5.3
- Author:
- o_sukhodolsky
-
-
Field Summary
Fields Modifier and Type Field Description static String
MSG_VAR_DECLARATIONS
Warning message key.static String
MSG_VAR_DECLARATIONS_COMMA
Warning message key.
-
Constructor Summary
Constructors Constructor Description MultipleVariableDeclarationsExtendedCheck()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getAcceptableTokens()
int[]
getDefaultTokens()
int[]
getRequiredTokens()
void
setIgnoreCycles(boolean value)
Enable|Disable declaration checking in cycles.void
setIgnoreMethods(boolean value)
Enable|Disable declaration checking in Methods.void
visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
void
work(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
Searches for wrong declarations and checks the their type.-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
beginTree, clearViolations, destroy, finishTree, getFileContents, getFilePath, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokens
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
-
-
-
-
Field Detail
-
MSG_VAR_DECLARATIONS_COMMA
public static final String MSG_VAR_DECLARATIONS_COMMA
Warning message key.- See Also:
- Constant Field Values
-
MSG_VAR_DECLARATIONS
public static final String MSG_VAR_DECLARATIONS
Warning message key.- See Also:
- Constant Field Values
-
-
Method Detail
-
setIgnoreCycles
public void setIgnoreCycles(boolean value)
Enable|Disable declaration checking in cycles.- Parameters:
value
- check declaration in Methods
-
setIgnoreMethods
public void setIgnoreMethods(boolean value)
Enable|Disable declaration checking in Methods. *- Parameters:
value
- check declaration in Methods
-
getDefaultTokens
public int[] getDefaultTokens()
- Specified by:
getDefaultTokens
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
getAcceptableTokens
public int[] getAcceptableTokens()
- Specified by:
getAcceptableTokens
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
getRequiredTokens
public int[] getRequiredTokens()
- Specified by:
getRequiredTokens
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
work
public void work(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
Searches for wrong declarations and checks the their type.- Parameters:
ast
- uses to get the parent or previous sibling token.
-
visitToken
public void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
- Overrides:
visitToken
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
-