Code containing duplicate String literals can usually be improved by declaring the String as a constant field.
Set the optional ignoreStrings
property to a comma-separated list (String) of
the strings that should be ignored by this rule (i.e., not cause a violation). This property
defaults to "" to ignore empty strings.
You can customize the delimiter for the ignoreStrings
by setting the ignoreStringsDelimiter
, which defaults to ",".
Set the optional duplicateStringMinimumLength
property to an integer so this rule
will ignore literal strings whose length is lower than this parameter (i.e., not cause a violation).
There is no default value for this property
By default, this rule does not apply to test files.
Fields inherited from class | Fields |
---|---|
class AbstractAstVisitorRule |
CLOSURE_TEXT, DEFAULT_CONST_NAME, DEFAULT_FIELD_NAME, DEFAULT_TEST_CLASS_NAMES, DEFAULT_TEST_FILES, DEFAULT_VAR_NAME |
Type | Name and description |
---|---|
java.lang.String |
doNotApplyToFilesMatching |
java.lang.Integer |
duplicateStringMinimumLength |
java.lang.String |
ignoreStrings |
char |
ignoreStringsDelimiter |
java.lang.String |
name |
int |
priority |
Type Params | Return Type | Name and description |
---|---|---|
|
AstVisitor |
getAstVisitor() |