com.puppycrawl.tools.checkstyle.checks
public class GenericIllegalRegexpCheck extends AbstractFormatCheck
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>
Constructor Summary | |
---|---|
GenericIllegalRegexpCheck()
Instantiates an new GenericIllegalRegexpCheck. |
Method Summary | |
---|---|
void | beginTree(DetailAST aRootAST) {@inheritDoc} |
int[] | getDefaultTokens() {@inheritDoc} |
String | getMessage()
Getter for message property. |
Pattern | getRegexp() |
void | setIgnoreCase(boolean aCaseInsensitive)
Set whether or not the match is case sensitive. |
void | setIgnoreComments(boolean aIgnoreComments)
Sets if comments should be ignored. |
void | setMessage(String aMessage)
Setter for message property. |
Returns: custom message which should be used to report about violations.
Returns: the regexp to match against
Parameters: aCaseInsensitive true if the match is case insensitive.
Parameters: aIgnoreComments True if comments should be ignored.
Parameters: aMessage custom message which should be used to report about violations.