com.puppycrawl.tools.checkstyle.checks
public class RegexpCheck extends AbstractFormatCheck
A check that makes sure that a specified pattern exists (or not) in the file.
An example of how to configure the check to make sure a copyright statement is included in the file (but without requirements on where in the file it should be):
<module name="RequiredRegexp"> <property name="format" value="This code is copyrighted"/> </module>
And to make sure the same statement appears at the beginning of the file.
<module name="RequiredRegexp"> <property name="format" value="\AThis code is copyrighted"/> </module>
Constructor Summary | |
---|---|
RegexpCheck()
Instantiates an new RegexpCheck. |
Method Summary | |
---|---|
void | beginTree(DetailAST aRootAST) {@inheritDoc} |
int[] | getDefaultTokens() {@inheritDoc} |
String | getMessage()
Getter for message property.
|
Pattern | getRegexp() |
void | setDuplicateLimit(int aDuplicateLimit)
Sets the maximum number of instances of required pattern allowed. |
void | setErrorLimit(int aErrorLimit)
Sets the limit on the number of errors to report. |
void | setIgnoreComments(boolean aIgnoreComments)
Sets if matches within comments should be ignored. |
void | setIllegalPattern(boolean aIllegalPattern)
Sets if pattern is illegal, otherwise pattern is required. |
void | setMessage(String aMessage)
Setter for message property. |
Returns: custom message to be used in report.
Returns: the regexp to match against
Parameters: aDuplicateLimit negative values mean no duplicate checking, any positive value is used as the limit.
Parameters: aErrorLimit the number of errors to report.
Parameters: aIgnoreComments True if comments should be ignored.
Parameters: aIllegalPattern True if pattern is not allowed.
Parameters: aMessage custom message which should be used in report.