Class GenericLiteralCheckerRule

  • All Implemented Interfaces:
    JavaParserVisitor, net.sourceforge.pmd.lang.rule.ImmutableLanguage, net.sourceforge.pmd.properties.PropertySource, net.sourceforge.pmd.Rule

    public class GenericLiteralCheckerRule
    extends AbstractJavaRule
    This class allow to match a Literal (most likely a String) with a regex pattern. Obviously, there are many applications of it (such as basic.xml/AvoidUsingHardCodedIP).
    Author:
    Romain PELISSE, [email protected]
    • Constructor Detail

      • GenericLiteralCheckerRule

        public GenericLiteralCheckerRule()
    • Method Detail

      • visit

        public java.lang.Object visit​(ASTLiteral node,
                                      java.lang.Object data)
        This method checks if the Literal matches the pattern. If it does, a violation is logged.
        Specified by:
        visit in interface JavaParserVisitor
        Overrides:
        visit in class AbstractJavaRule