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.AbstractCheckCustom 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 StringMSG_KEY_CONFIG_NOT_ASSIGNEDViolations message.static StringMSG_KEY_CONFIG_NOT_ASSIGNED_PROPERLYViolations message.static StringMSG_KEY_CONFIG_NOT_ASSIGNED_WITHViolations message.static StringMSG_KEY_CONFIG_NOT_FOUNDViolations message.static StringMSG_KEY_UNKNOWN_PROPERTYViolations message.
-
Constructor Summary
Constructors Constructor Description CheckstyleTestMakeupCheck()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginTree(com.puppycrawl.tools.checkstyle.api.DetailAST rootAST)int[]getAcceptableTokens()int[]getDefaultTokens()int[]getRequiredTokens()voidleaveToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)voidsetCreateMethodRegexp(Pattern createMethodRegexp)Setter forcreateMethodRegexp.voidsetVerifyMethodRegexp(Pattern verifyMethodRegexp)Setter forverifyMethodRegexp.voidvisitToken(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:
getDefaultTokensin classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
getAcceptableTokens
public int[] getAcceptableTokens()
- Specified by:
getAcceptableTokensin classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
getRequiredTokens
public int[] getRequiredTokens()
- Specified by:
getRequiredTokensin classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
beginTree
public void beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST rootAST)
- Overrides:
beginTreein classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
visitToken
public void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
- Overrides:
visitTokenin classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
leaveToken
public void leaveToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
- Overrides:
leaveTokenin classcom.puppycrawl.tools.checkstyle.api.AbstractCheck
-
-