|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.Check
com.puppycrawl.tools.checkstyle.checks.AbstractFormatCheck
com.puppycrawl.tools.checkstyle.checks.RegexpCheck
public class RegexpCheck
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)
Called before the starting to process a tree. |
int[] |
getDefaultTokens()
Returns the default token a check is interested in. |
String |
getMessage()
Getter for message property. |
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. |
| Methods inherited from class com.puppycrawl.tools.checkstyle.checks.AbstractFormatCheck |
|---|
getFormat, getRegexp, setCompileFlags, setFormat |
| Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check |
|---|
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken |
| Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter |
|---|
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity |
| Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean |
|---|
configure, contextualize, finishLocalSetup, getConfiguration, setupChild |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RegexpCheck()
| Method Detail |
|---|
public void setMessage(String aMessage)
aMessage - custom message which should be used in report.public String getMessage()
public void setIgnoreComments(boolean aIgnoreComments)
aIgnoreComments - True if comments should be ignored.public void setIllegalPattern(boolean aIllegalPattern)
aIllegalPattern - True if pattern is not allowed.public void setErrorLimit(int aErrorLimit)
aErrorLimit - the number of errors to report.public void setDuplicateLimit(int aDuplicateLimit)
aDuplicateLimit - negative values mean no duplicate checking,
any positive value is used as the limit.public int[] getDefaultTokens()
Check
getDefaultTokens in class CheckTokenTypespublic void beginTree(DetailAST aRootAST)
Check
beginTree in class CheckaRootAST - the root of the tree
|
Back to the Checkstyle Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||