mirror of
https://github.com/alibaba/p3c.git
synced 2025-10-15 07:32:36 +00:00
Merge pull request #153 from LQZYC/master
fix issue #68 support package name like ali88.ps.service
This commit is contained in:
@@ -30,7 +30,7 @@ import net.sourceforge.pmd.lang.ast.Node;
|
|||||||
*/
|
*/
|
||||||
public class PackageNamingRule extends AbstractXpathRule {
|
public class PackageNamingRule extends AbstractXpathRule {
|
||||||
private static final String XPATH = "//PackageDeclaration/Name\n"
|
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() {
|
public PackageNamingRule() {
|
||||||
setXPath(XPATH);
|
setXPath(XPATH);
|
||||||
|
@@ -31,5 +31,19 @@
|
|||||||
</test-code>
|
</test-code>
|
||||||
|
|
||||||
|
|
||||||
|
<code-fragment id="PackageNamingRule2">
|
||||||
|
<![CDATA[
|
||||||
|
package ali88.ps.service;
|
||||||
|
public class SomeClass {
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</code-fragment>
|
||||||
|
<test-code>
|
||||||
|
<description>Package Name should be lowercase</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code-ref id="PackageNamingRule2" />
|
||||||
|
</test-code>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</test-data>
|
</test-data>
|
||||||
|
Reference in New Issue
Block a user