|
||||||||||
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.coding.MagicNumberCheck
public class MagicNumberCheck
Checks for magic numbers.
An example of how to configure the check to ignore numbers 0, 1, 1.5, 2:
<module name="MagicNumber"> <property name="ignoreNumbers" value="0, 1, 1.5, 2"/> <property name="ignoreHashCodeMethod" value="true"/> </module>
Constructor Summary | |
---|---|
MagicNumberCheck()
|
Method Summary | |
---|---|
int[] |
getDefaultTokens()
Returns the default token a check is interested in. |
void |
setIgnoreAnnotation(boolean aIgnoreAnnotation)
Set whether to ignore Annotations. |
void |
setIgnoreHashCodeMethod(boolean aIgnoreHashCodeMethod)
Set whether to ignore hashCode methods. |
void |
setIgnoreNumbers(double[] aList)
Sets the numbers to ignore in the check. |
void |
visitToken(DetailAST aAST)
Called to process a token. |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check |
---|
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens |
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 MagicNumberCheck()
Method Detail |
---|
public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
public void visitToken(DetailAST aAST)
Check
visitToken
in class Check
aAST
- the token to processpublic void setIgnoreNumbers(double[] aList)
aList
- list of numbers to ignore.public void setIgnoreHashCodeMethod(boolean aIgnoreHashCodeMethod)
aIgnoreHashCodeMethod
- decide whether to ignore
hash code methodspublic void setIgnoreAnnotation(boolean aIgnoreAnnotation)
aIgnoreAnnotation
- decide whether to ignore annotations
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |