Class CheckstyleTestMakeupCheck
- 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.design.CheckstyleTestMakeupCheck
-
- All Implemented Interfaces:
com.puppycrawl.tools.checkstyle.api.Configurable
,com.puppycrawl.tools.checkstyle.api.Contextualizable
public class CheckstyleTestMakeupCheck extends com.puppycrawl.tools.checkstyle.api.AbstractCheck
Custom check to ensure Checkstyle tests are designed correctly.
Rationale: This check was made to ensure tests follow a specific design implementation so 3rd party utilities like the regression utility can parse the tests for information used in creating regression reports.
Check have following options:
-
createMethodRegexp - Regular expression for matching a create configuration method by name. This
is the name of the method that starts creating a custom module configuration to be used for
verifying results for regression purposes.
Default value is
create(Root|Module)Config|getModuleConfig
. -
verifyMethodRegexp - Regular expression for matching a verify method by name. This is the name
of the method that verifies the execution results of the custom configuration created for
regression. As such, it should accept the custom configuration as a parameter.
Default value is
verify(Warns|Suppressed)?
.
To configure the check to report incorrectly made checkstyle tests:
<module name="CheckstyleTestMakeup"/>
- Since:
- 1.25.0
- Author:
- Richard Veach
-
-
Field Summary
Fields Modifier and Type Field Description static String
MSG_KEY_CONFIG_NOT_ASSIGNED
Violations message.static String
MSG_KEY_CONFIG_NOT_ASSIGNED_PROPERLY
Violations message.static String
MSG_KEY_CONFIG_NOT_ASSIGNED_WITH
Violations message.static String
MSG_KEY_CONFIG_NOT_FOUND
Violations message.static String
MSG_KEY_UNKNOWN_PROPERTY
Violations message.
-
Constructor Summary
Constructors Constructor Description CheckstyleTestMakeupCheck()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST rootAST)
int[]
getAcceptableTokens()
int[]
getDefaultTokens()
int[]
getRequiredTokens()
void
leaveToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
void
setCreateMethodRegexp(Pattern createMethodRegexp)
Setter forcreateMethodRegexp
.void
setVerifyMethodRegexp(Pattern verifyMethodRegexp)
Setter forverifyMethodRegexp
.void
visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
clearViolations, destroy, finishTree, getFileContents, getFilePath, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, init, isCommentNodesRequired, 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_KEY_CONFIG_NOT_ASSIGNED
public static final String MSG_KEY_CONFIG_NOT_ASSIGNED
Violations message.- See Also:
- Constant Field Values
-
MSG_KEY_CONFIG_NOT_ASSIGNED_WITH
public static final String MSG_KEY_CONFIG_NOT_ASSIGNED_WITH
Violations message.- See Also:
- Constant Field Values
-
MSG_KEY_CONFIG_NOT_ASSIGNED_PROPERLY
public static final String MSG_KEY_CONFIG_NOT_ASSIGNED_PROPERLY
Violations message.- See Also:
- Constant Field Values
-
MSG_KEY_UNKNOWN_PROPERTY
public static final String MSG_KEY_UNKNOWN_PROPERTY
Violations message.- See Also:
- Constant Field Values
-
MSG_KEY_CONFIG_NOT_FOUND
public static final String MSG_KEY_CONFIG_NOT_FOUND
Violations message.- See Also:
- Constant Field Values
-
-
Method Detail
-
setCreateMethodRegexp
public void setCreateMethodRegexp(Pattern createMethodRegexp)
Setter forcreateMethodRegexp
.- Parameters:
createMethodRegexp
- The value to set.
-
setVerifyMethodRegexp
public void setVerifyMethodRegexp(Pattern verifyMethodRegexp)
Setter forverifyMethodRegexp
.- Parameters:
verifyMethodRegexp
- The value to set.
-
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
-
beginTree
public void beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST rootAST)
- Overrides:
beginTree
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
visitToken
public void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
- Overrides:
visitToken
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
leaveToken
public void leaveToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
- Overrides:
leaveToken
in classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
-