com.puppycrawl.tools.checkstyle.checks
Class GenericIllegalRegexpCheck
- Configurable, Contextualizable
public class GenericIllegalRegexpCheck
A generic check for code problems, the user can search for any pattern.
This is similar to a recursive grep, only that it's integrated in checkstyle.
Rationale: This Check can be used to prototype checks and to find common
bad pratice such as calling
ex.printStacktrace(), System.out.println(), System.exit(), etc.
An example of how to configure the check for calls to
System.out.println
is:
<module name="GenericIllegalRegexp">
<property name="format" value="System\.out\.println"/>
</module>
- lkuehne
- Bill Schneider
- Daniel Grenner
beginTree , destroy , finishTree , getAcceptableTokens , getClassLoader , getDefaultTokens , getFileContents , getLines , getRequiredTokens , getTabWidth , getTokenNames , init , leaveToken , log , log , setClassLoader , setFileContents , setMessages , setTabWidth , setTokens , visitToken |
getMessageBundle , getSeverity , getSeverityLevel , log , log , log , log , log , log , log , log , log , log , log , setSeverity |
GenericIllegalRegexpCheck
public GenericIllegalRegexpCheck()
Instantiates an new GenericIllegalRegexpCheck.
getDefaultTokens
public int[] getDefaultTokens()
- getDefaultTokens in interface Check
Check
getMessage
public String getMessage()
Getter for message property.
- custom message which should be used
to report about violations.
getRegexp
public RE getRegexp()
- getRegexp in interface AbstractFormatCheck
- the regexp to match against
setIgnoreCase
public void setIgnoreCase(boolean aCaseInsensitive)
Set whether or not the match is case sensitive.
aCaseInsensitive
- true if the match is case insensitive.
setIgnoreComments
public void setIgnoreComments(boolean aIgnoreComments)
Sets if comments should be ignored.
aIgnoreComments
- True if comments should be ignored.
setMessage
public void setMessage(String aMessage)
Setter for message property.
aMessage
- custom message which should be used
to report about violations.