From 8a2cd82a73f02e0c75111ecc59b68806dc4983c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=B6=E4=B9=90?= Date: Wed, 1 Nov 2017 09:36:49 +0800 Subject: [PATCH] fix issue #68 --- .../lang/java/rule/naming/PackageNamingRule.java | 2 +- .../java/rule/naming/xml/PackageNamingRule.xml | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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 + + + +