@@ -23,140 +23,55 @@ limitations under the License.
2323
2424 <description >PMD Rules</description >
2525
26- <rule ref =" rulesets/java/basic.xml" />
27- <rule ref =" rulesets/java/braces.xml" />
28- <rule ref =" rulesets/java/clone.xml" />
29- <rule ref =" rulesets/java/unusedcode.xml" />
30- <rule ref =" rulesets/java/finalizers.xml" />
31-
32-
33- <rule ref =" rulesets/java/imports.xml" >
34- <!-- Stupid rule... -->
35- <exclude name =" TooManyStaticImports" />
36- </rule >
37-
38- <rule ref =" rulesets/java/codesize.xml" >
39- <!-- See the explanation for TooManyMethods.-->
40- <exclude name =" TooManyFields" />
41- <!-- Design is very hard to measure by numbers like this.-->
42- <!-- The number and quality of dependencies might be a better indicator, -->
43- <!-- and that requires a different tool.-->
44- <exclude name =" TooManyMethods" />
45- <!-- See the explanation for TooManyMethods.-->
46- <exclude name =" ExcessivePublicCount" />
47- <!-- Needs better understanding and proper configuration-->
48- <exclude name =" StdCyclomaticComplexity" />
49- <!-- Needs better understanding and proper configuration-->
50- <exclude name =" ModifiedCyclomaticComplexity" />
51- <!-- See the explanation for TooManyMethods.-->
52- <exclude name =" ExcessiveParameterList" />
53- <!-- Too abstract rule -->
54- <exclude name =" CyclomaticComplexity" />
55- </rule >
56-
57- <rule ref =" rulesets/java/design.xml" >
58- <!-- Sometimes important to avoid "DOS attack" but not as a general rule-->
59- <exclude name =" AvoidSynchronizedAtMethodLevel" />
60- <!-- It's just extra effort to write and read the final keyword-->
61- <exclude name =" ClassWithOnlyPrivateConstructorsShouldBeFinal" />
62- <!-- Maybe good idea if PMD could exclude null checks from this-->
63- <exclude name =" ConfusingTernary" />
64- <!-- Statistical analysis is prone to givin false positives. Potential god classes-->
65- <!-- most probably violate something else, too.-->
66- <!-- And dependency analysis tools also help here.-->
67- <exclude name =" GodClass" />
68- <!-- Switch is sometimes very readable-->
69- <exclude name =" TooFewBranchesForASwitchStatement" />
70- <!-- A static utility is a static utility even if it masquerades as something-->
71- <!-- else by using the Singleton pattern-->
72- <exclude name =" UseUtilityClass" />
73- <!-- This is good advice, but since it's violated so much in this project-->
74- <!-- and the problem is not big (especially with good syntax colouring),-->
75- <!-- we'll keep this ignored for now.-->
76- <exclude name =" AvoidReassigningParameters" />
77- <!-- Good idea almost always, but not quite.-->
78- <!-- <exclude name="ReturnEmptyArrayRatherThanNull" />-->
79- <!-- Sometimes one step at a time makes clearer code.-->
80- <!-- Debugging is also easier if the return value is in a variable.-->
81- <exclude name =" UnnecessaryLocalBeforeReturn" />
82- <!-- There are valid reasons for passing arrays (making it nullable for example)-->
26+ <rule ref =" category/java/bestpractices.xml" >
8327 <exclude name =" UseVarargs" />
84- <!-- TODO explain what false positives this gives-->
85- <exclude name =" MissingBreakInSwitch" />
86- <!-- TODO enable when all findings have been fixed-->
87- <exclude name =" UseLocaleWithCaseConversions" />
88- <!-- It gives a lot of warnings on 'equals' method, fixing would decrease readability-->
89- <exclude name =" SimplifyBooleanReturns" />
90- <!-- Gives false positive-->
91- <exclude name =" FieldDeclarationsShouldBeAtStartOfClass" />
92- <!-- Good rule but in practice to often suppressed -->
93- <exclude name =" PreserveStackTrace" />
94-
95- <exclude name =" AccessorMethodGeneration" />
9628 </rule >
97-
98- <rule ref =" rulesets/java/migrating.xml" >
99- <!-- The annotation is not as readable and there is no way to state which-->
100- <!-- line should throw the exception and with what message-->
101- <exclude name =" JUnitUseExpected" />
102- <!-- Main code is not junit code-->
103- <exclude name =" JUnit4TestShouldUseTestAnnotation" />
104- </rule >
105-
106- <rule ref =" rulesets/java/naming.xml" >
107- <!-- Often good to start name with Abstract, but on the other hand this-->
108- <!-- rule is a bit too much like Hungarian notation and I in interface names.-->
109- <!-- Who cares if it's abstract or not when you are using it?-->
29+ <rule ref =" category/java/codestyle.xml" >
11030 <exclude name =" AbstractNaming" />
111- <!-- Opinion, for me a getter is not a command, it's a declarative-->
112- <!-- data reference-->
113- <exclude name =" AvoidFieldNameMatchingMethodName" />
114- <!-- Why should generics not be named properly, like all other things-->
115- <!-- (well, except Windows filesystem roots)?-->
116- <exclude name =" GenericsNaming" />
117- <!-- It can be long if it's the only way to make it good-->
31+ <exclude name =" AtLeastOneConstructor" />
32+ <exclude name =" AvoidPrefixingMethodParameters" />
33+ <exclude name =" CommentDefaultAccessModifier" />
34+ <exclude name =" DefaultPackage" />
35+ <exclude name =" FieldDeclarationsShouldBeAtStartOfClass" />
36+ <exclude name =" LocalVariableCouldBeFinal" />
11837 <exclude name =" LongVariable" />
119- <!-- It can be short if it's good-->
120- <exclude name =" ShortVariable" />
121- <!-- TODO explain why.-->
122- <exclude name =" BooleanGetMethodName" />
123- <!-- It can be short if it's good-->
38+ <exclude name =" MethodArgumentCouldBeFinal" />
39+ <exclude name =" OnlyOneReturn" />
12440 <exclude name =" ShortClassName" />
125- <!-- It can be short if it's good-->
12641 <exclude name =" ShortMethodName" />
42+ <exclude name =" ShortVariable" />
43+ <exclude name =" TooManyStaticImports" />
44+ <exclude name =" UselessParentheses" />
12745 </rule >
128-
129- <rule ref =" rulesets/java/optimizations.xml" >
130- <!-- Too many false hits. Optimization can't be done with static analysis.
131- Besides, following this may encourage the antipattern of using too broad
132- scope for stuff: -->
133- <exclude name =" AvoidInstantiatingObjectsInLoops" />
134- <!-- Good principle but too verbose in practice: -->
135- <exclude name =" MethodArgumentCouldBeFinal" />
136- <!-- Good principle and maybe sometimes even practical but not in this
137- project: -->
138- <exclude name =" LocalVariableCouldBeFinal" />
139- </rule >
140-
141- <rule ref =" rulesets/java/strictexception.xml" >
142- <!-- NPE communicates very cleary what is happening, it is not-->
143- <!-- interesting who reports it (jvm or user code)-->
144- <exclude name =" AvoidThrowingNullPointerException" />
145- <!-- TODO explain why-->
46+ <rule ref =" category/java/design.xml" >
14647 <exclude name =" AvoidCatchingGenericException" />
147- <!-- TODO explain why-->
148- <exclude name =" AvoidThrowingRawExceptionTypes" />
149- <!-- One valid case is to catch runtime, throw as such and after that-->
150- <!-- catch Exception and wrap as runtime.-->
151- <!-- Without the first all runtimes are unnecessarily wrapped.-->
15248 <exclude name =" AvoidRethrowingException" />
153- <!-- There are case which should throws generic exceptions -->
154- <exclude name =" SignatureDeclareThrowsException" />
49+ <exclude name =" AvoidThrowingNullPointerException" />
50+ <exclude name =" ExcessiveImports" />
51+ <exclude name =" LawOfDemeter" />
52+ <exclude name =" LoosePackageCoupling" />
53+ <exclude name =" TooManyFields" />
54+ <exclude name =" TooManyMethods" />
55+
56+ <!-- remove it -->
57+ <exclude name =" NcssCount" />
15558 </rule >
59+ <rule ref =" category/java/documentation.xml" >
60+ <exclude name =" CommentSize" />
15661
157- <rule ref =" rulesets/java/strings.xml" >
158- <!-- Splitting to multiple lines is sometimes more readable.-->
159- <!-- Besides, where's the proof that it affects performance?-->
160- <exclude name =" ConsecutiveAppendsShouldReuse" />
62+ <!-- remove it -->
63+ <exclude name =" CommentRequired" />
64+ </rule >
65+ <rule ref =" category/java/errorprone.xml" >
66+ <exclude name =" AvoidFieldNameMatchingTypeName" />
67+ <exclude name =" AvoidFieldNameMatchingMethodName" />
68+ <exclude name =" BeanMembersShouldSerialize" />
69+ <exclude name =" DataflowAnomalyAnalysis" />
70+ <exclude name =" MissingBreakInSwitch" />
71+ </rule >
72+ <rule ref =" category/java/multithreading.xml" >
73+ </rule >
74+ <rule ref =" category/java/performance.xml" >
75+ <exclude name =" AvoidUsingShortType" />
16176 </rule >
16277</ruleset >
0 commit comments