com.puppycrawl.tools.checkstyle.checks
Class RegexpCheck
- Configurable, Contextualizable
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>
beginTree , destroy , finishTree , getAcceptableTokens , getClassLoader , getDefaultTokens , getFileContents , getLines , getRequiredTokens , getTabWidth , getTokenNames , init , leaveToken , log , log , setClassLoader , setFileContents , setMessages , setTabWidth , setTokens , visitToken |
getId , getMessageBundle , getSeverity , getSeverityLevel , log , log , log , log , log , log , log , log , log , log , log , setId , setSeverity |
RegexpCheck
public RegexpCheck()
Instantiates an new RegexpCheck.
getMessage
public String getMessage()
Getter for message property.
I'm not sure if this gets used by anything outside,
I just included it because GenericIllegalRegexp had it,
it's being used in logMessage() so it's covered in EMMA.
- custom message to be used in report.
setDuplicateLimit
public void setDuplicateLimit(int aDuplicateLimit)
Sets the maximum number of instances of required pattern allowed.
aDuplicateLimit
- negative values mean no duplicate checking,
any positive value is used as the limit.
setErrorLimit
public void setErrorLimit(int aErrorLimit)
Sets the limit on the number of errors to report.
aErrorLimit
- the number of errors to report.
setIgnoreComments
public void setIgnoreComments(boolean aIgnoreComments)
Sets if matches within comments should be ignored.
aIgnoreComments
- True if comments should be ignored.
setIllegalPattern
public void setIllegalPattern(boolean aIllegalPattern)
Sets if pattern is illegal, otherwise pattern is required.
aIllegalPattern
- True if pattern is not allowed.
setMessage
public void setMessage(String aMessage)
Setter for message property.
aMessage
- custom message which should be used in report.