-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathruleset.xml
53 lines (51 loc) · 3.24 KB
/
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
<?xml version="1.0"?>
<ruleset name="Custom Rules"
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 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
My custom rules
</description>
<rule ref="category/java/bestpractices.xml">
<exclude name="GuardLogStatement"/> <!-- because we pull the logging from the message bundle which triggers this regardless -->
</rule>
<rule ref="category/java/codestyle.xml">
<exclude name="AtLeastOneConstructor"/> <!-- because it seems pointless to have to have an empty default constructor -->
<exclude name="CommentDefaultAccessModifier" /> <!-- annoying to have to comment /*default*/ -->
<exclude name="FieldNamingConventions"/> <!-- because we don't follow the convention for static fields. Since this is merely stylistic there isn't much concern for it be exempted -->
<exclude name="FinalParameterInAbstractMethod" /> <!-- I would rather the implementation ignore it, that is on the person who implemented it -->
<exclude name="LambdaCanBeMethodReference" /> <!-- for readability I don't want to be forced to use method reference -->
<exclude name="LongVariable"/> <!-- I would rather have long variable names that are descriptive -->
<exclude name="ShortClassName"/> <!-- because it thinks "Bag" is too short -->
</rule>
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
<properties>
<property name="junit3TestPattern" value="test[A-Z0-9][a-zA-Z0-9]*" />
<property name="junit4TestPattern" value="[a-z][a-zA-Z0-9]*" />
<property name="methodPattern" value="[a-z][a-zA-Z0-9]*" />
<property name="nativePattern" value="[a-z][a-zA-Z0-9]*" />
<property name="staticPattern" value="[a-zA-Z0-9_]*" />
</properties>
</rule>
<rule ref="category/java/design.xml">
<exclude name="DataClass"/> <!-- POJOs are fine -->
<exclude name="ExcessiveImports"/> <!-- because we want to reuse code sometimes the imports can be high -->
<exclude name="LawOfDemeter"/> <!-- because we often use other classes directly when they are singletons -->
<exclude name="LoosePackageCoupling"/> <!-- requires configuration to be used correctly -->
</rule>
<rule ref="category/java/documentation.xml">
<exclude name="CommentRequired"/> <!-- TODO configure which ones we actually want -->
<exclude name="CommentSize"/> <!-- TODO configure to reasonable amounts -->
</rule>
<rule ref="category/java/errorprone.xml">
<exclude name="AvoidLiteralsInIfCondition"/> <!-- we only use variables when the string is repeated multiple times and it is worth using a static variable instead -->
<exclude name="InvalidLogMessageFormat"/> <!-- Doesn't recognize message bundles -->
</rule>
<rule ref="category/java/multithreading.xml">
</rule>
<rule ref="category/java/performance.xml">
<exclude name="AvoidInstantiatingObjectsInLoops"/> <!-- Where creating objects, how do you not create them in loops? -->
</rule>
<rule ref="category/java/security.xml">
</rule>
</ruleset>