-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpmdrules.xml
101 lines (93 loc) · 4.23 KB
/
pmdrules.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?xml version="1.0"?>
<ruleset name="iObserve PMD ruleset" 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"
xsi:noNamespaceSchemaLocation="http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
This ruleset is checked for iObserve automatically.
</description>
<!-- exclude generated code -->
<exclude-pattern>.*/src/gen/.*</exclude-pattern>
<exclude-pattern>.*/test/gen/.*</exclude-pattern>
<!-- We'll use the following rulesets -->
<rule ref="rulesets/internal/all-java.xml">
<exclude name="AvoidCatchingNPE" />
<exclude name="AvoidDuplicateLiterals" />
<exclude name="AvoidFinalLocalVariable" />
<exclude name="AvoidInstantiatingObjectsInLoops" />
<exclude name="AvoidLiteralsInIfCondition" />
<!-- exclude name="AvoidPrefixingMethodParameters" /-->
<exclude name="AvoidThrowingNullPointerException" />
<exclude name="AvoidUsingVolatile" />
<exclude name="AssignmentInOperand"/>
<exclude name="BeanMembersShouldSerialize" />
<exclude name="CallSuperInConstructor" />
<exclude name="CommentSize" />
<exclude name="ConfusingTernary" />
<exclude name="CyclomaticComplexity" />
<exclude name="DataflowAnomalyAnalysis" />
<exclude name="DoNotCallSystemExit" />
<exclude name="DoNotUseThreads" />
<exclude name="ExcessiveImports" />
<exclude name="ExcessiveMethodLength" />
<exclude name="ExcessiveParameterList" />
<exclude name="GodClass" />
<exclude name="LawOfDemeter" />
<exclude name="LongVariable" />
<exclude name="LoosePackageCoupling" />
<!-- exclude name="NcssMethodCount" /-->
<exclude name="NPathComplexity" />
<exclude name="OnlyOneReturn" />
<exclude name="PackageCase" />
<!-- startsWith is better: it returns false instead of an IndexOutOfBoundsException and its name reflects its purpose -->
<exclude name="SimplifyStartsWith" />
<exclude name="ShortClassName" />
<exclude name="ShortVariable" />
<exclude name="SignatureDeclareThrowsException" />
<!-- Java automatically compiles to StringBuilder and StringBuffer is unnecessarily synchronized -->
<exclude name="UseStringBufferForStringAppends" />
<exclude name="TooManyMethods" />
<exclude name="UnnecessaryConstructor" />
<exclude name="UnnecessaryModifier" />
<exclude name="UseObjectForClearerAPI" />
<exclude name="UseProperClassLoader" />
<exclude name="UselessParentheses" />
<exclude name="UseVarargs" />
<exclude name="AtLeastOneConstructor"/>
<exclude name="UseConcurrentHashMap"/>
</rule>
<rule ref="rulesets/internal/all-java.xml/ConsecutiveLiteralAppends">
<properties>
<property name="threshold" value="2"/>
</properties>
</rule>
<!-- Here's some rules we'll specify one at a time -->
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable"/>
<rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
<rule ref="category/java/codestyle.xml/DuplicateImports"/>
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary"/>
<!-- We want to customize this rule a bit, change the message and raise the priority -->
<rule ref="category/java/errorprone.xml/EmptyCatchBlock" message="Must handle exceptions">
<priority>2</priority>
</rule>
<!-- ensure comments -->
<rule ref="category/java/documentation.xml/CommentRequired">
<!-- <priority>5</priority> -->
<properties>
<property name="violationSuppressXPath"
value="//ClassOrInterfaceBodyDeclaration/MethodDeclaration/MethodDeclarator[matches(@Image,'(get|is|set)[\p{Lu}].*') and not(FormalParameters/FormalParameter)]" />
<property name="fieldCommentRequirement" value="Ignored" />
<property name="protectedMethodCommentRequirement" value="Ignored" />
<property name="publicMethodCommentRequirement" value="Ignored" />
</properties>
</rule>
<!-- Now we'll customize a rule's property value -->
<rule ref="category/java/design.xml/CyclomaticComplexity">
<properties>
<property name="methodReportLevel" value="8"/>
<property name="classReportLevel" value="8"/>
</properties>
</rule>
<!-- We want everything from braces.xml -->
<rule ref="category/java/codestyle.xml/ControlStatementBraces"/>
</ruleset>