-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpmd-rules.xml
More file actions
36 lines (35 loc) · 1.28 KB
/
pmd-rules.xml
File metadata and controls
36 lines (35 loc) · 1.28 KB
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
<?xml version="1.0"?>
<!-- TODO currently this isn't configured or used in by maven - do we want it? -->
<ruleset name="SpringRichRules">
<description>Checks for bad usage of anonymous inner classes</description>
<rule name="UsingAnonymousClassForListener"
message="Never use an anonymous inner class to implement a listener"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
</description>
<priority>3</priority>
<example><![CDATA[
ValueModel vm = ...
vm.addValueChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
...
};
});
]]></example>
<properties>
<property name="xpath">
<value><![CDATA[
//PrimaryExpression
[
(
PrimaryPrefix/Name[(starts-with(@Image, 'add') or contains(@Image, '.add')) and ends-with(@Image, 'Listener')]
or
PrimarySuffix[(starts-with(@Image, 'add') or contains(@Image, '.add')) and ends-with(@Image, 'Listener')]
)
and PrimarySuffix/Arguments/ArgumentList/Expression/PrimaryExpression/PrimaryPrefix/AllocationExpression
]
]]></value>
</property>
</properties>
</rule>
</ruleset>