-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp3c-ruleset.xml
80 lines (76 loc) · 4.49 KB
/
p3c-ruleset.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?xml version="1.0"?>
<ruleset name="DwautoJavaRule" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>阿里巴巴开发手册规则配置</description>
<!-- 配置忽略检查的路径,注意以绝对路径匹配,语法为正则表达式 -->
<exclude-pattern>.*/\.mvn/.*</exclude-pattern>
<exclude-pattern>.*/target/.*</exclude-pattern>
<exclude-pattern>.*/src/test/.*</exclude-pattern>
<rule ref="rulesets/java/ali-comment.xml">
<!-- 配置忽略检查的规则 -->
<!-- https://github.com/alibaba/p3c/tree/master/p3c-pmd/src/main/resources/rulesets/java -->
<!-- <exclude name="CallSuperLast" /> -->
<exclude name="AvoidCommentBehindStatementRule" />
</rule>
<rule ref="rulesets/java/ali-concurrent.xml"></rule>
<rule ref="rulesets/java/ali-constant.xml">
<exclude name="UndefineMagicConstantRule" />
</rule>
<rule ref="rulesets/java/ali-exception.xml"></rule>
<rule ref="rulesets/java/ali-flowcontrol.xml"></rule>
<rule ref="rulesets/java/ali-naming.xml">
<exclude name="AbstractClassShouldStartWithAbstractNamingRule" />
<exclude name="LowerCamelCaseVariableNamingRule" />
<exclude name="ServiceOrDaoClassShouldEndWithImplRule" />
</rule>
<rule ref="rulesets/java/ali-oop.xml"></rule>
<rule ref="rulesets/java/ali-orm.xml"></rule>
<rule ref="rulesets/java/ali-other.xml"></rule>
<rule ref="rulesets/java/ali-set.xml"></rule>
<!-- Best practices from https://pmd.github.io/pmd-6.39.0/pmd_rules_java_bestpractices.html-->
<rule ref="category/java/bestpractices.xml/AvoidMessageDigestField" />
<rule ref="category/java/bestpractices.xml/AvoidPrintStackTrace" />
<rule ref="category/java/bestpractices.xml/AvoidReassigningCatchVariables" />
<rule ref="category/java/bestpractices.xml/AvoidStringBufferField" />
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
<rule ref="category/java/bestpractices.xml/DoubleBraceInitialization" />
<rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach" />
<rule ref="category/java/bestpractices.xml/ForLoopVariableCount">
<properties>
<property name="maximumVariables" value="2" />
</properties>
</rule>
<rule ref="category/java/bestpractices.xml/GuardLogStatement">
<properties>
<property name="logLevels" value="trace,debug" />
<property name="guardsMethods" value="isTraceEnabled,isDebugEnabled" />
</properties>
</rule>
<rule ref="category/java/bestpractices.xml/MissingOverride" />
<rule ref="category/java/bestpractices.xml/OneDeclarationPerLine" />
<rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" />
<rule ref="category/java/bestpractices.xml/ReplaceEnumerationWithIterator" />
<rule ref="category/java/bestpractices.xml/SwitchStmtsShouldHaveDefault" />
<rule ref="category/java/bestpractices.xml/SystemPrintln" />
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty" />
<rule ref="category/java/bestpractices.xml/UseTryWithResources" />
<!-- Code style from https://pmd.github.io/pmd-6.39.0/pmd_rules_java_codestyle.html-->
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass" />
<rule ref="category/java/codestyle.xml/CallSuperInConstructor" />
<rule ref="category/java/codestyle.xml/FieldDeclarationsShouldBeAtStartOfClass" />
<rule ref="category/java/codestyle.xml/FieldDeclarationsShouldBeAtStartOfClass" />
<rule ref="category/java/codestyle.xml/ShortMethodName" />
<rule ref="category/java/codestyle.xml/ShortVariable" />
<rule ref="category/java/codestyle.xml/UnnecessaryAnnotationValueElement" />
<rule ref="category/java/codestyle.xml/UnnecessaryLocalBeforeReturn" />
<rule ref="category/java/codestyle.xml/UseDiamondOperator" />
<rule ref="category/java/codestyle.xml/UseShortArrayInitializer" />
<rule ref="category/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal" />
<rule ref="category/java/design.xml/CollapsibleIfStatements" />
<rule ref="category/java/design.xml/LogicInversion" />
<rule ref="category/java/design.xml/UseUtilityClass" />
<rule ref="category/java/performance.xml/AddEmptyString" />
<rule ref="category/java/performance.xml/AppendCharacterWithChar" />
<rule ref="category/java/performance.xml/AvoidCalendarDateCreation" />
</ruleset>