diff --git a/p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/naming/PackageNamingRule.java b/p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/naming/PackageNamingRule.java index fb3ff15..d722772 100644 --- a/p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/naming/PackageNamingRule.java +++ b/p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/naming/PackageNamingRule.java @@ -30,7 +30,7 @@ import net.sourceforge.pmd.lang.ast.Node; */ public class PackageNamingRule extends AbstractXpathRule { private static final String XPATH = "//PackageDeclaration/Name\n" - + "[not (matches(@Image, '^[a-z]+(\\.[a-z][a-z0-9]*)*$'))]"; + + "[not (matches(@Image, '^[a-z0-9]+(\\.[a-z][a-z0-9]*)*$'))]"; public PackageNamingRule() { setXPath(XPATH); diff --git a/p3c-pmd/src/test/resources/com/alibaba/p3c/pmd/lang/java/rule/naming/xml/PackageNamingRule.xml b/p3c-pmd/src/test/resources/com/alibaba/p3c/pmd/lang/java/rule/naming/xml/PackageNamingRule.xml index 02ee353..e15caeb 100644 --- a/p3c-pmd/src/test/resources/com/alibaba/p3c/pmd/lang/java/rule/naming/xml/PackageNamingRule.xml +++ b/p3c-pmd/src/test/resources/com/alibaba/p3c/pmd/lang/java/rule/naming/xml/PackageNamingRule.xml @@ -31,5 +31,19 @@ + + + + + Package Name should be lowercase + 0 + + + +