blob: 9e1c492238d692ae23882fe8f6b05f5dc56fdab6 (
plain) (
blame)
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
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ruleset name="Custom PMD Ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>PMD Logging Rule Set for Jetty</description>
<!-- CUSTOM RULES -->
<rule name="AvoidAnonymousLogging"
since="1.0"
message="Use named logging, not anonymous"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
AvoidAnonymousLogging finds instances of Anonymous logging use.
This is bad form and treats logging of the system as a whole, not
discrete parts that can be adjusted (attaching different levels and
appenders depending on need)
</description>
<priority>3</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//Name[
starts-with(@Image, 'Log.debug')
or
starts-with(@Image, 'Log.ignore')
or
starts-with(@Image, 'Log.info')
or
starts-with(@Image, 'Log.isDebugEnabled')
or
starts-with(@Image, 'Log.warn')
or
starts-with(@Image, 'org.eclipse.jetty.util.log.Log.debug')
or
starts-with(@Image, 'org.eclipse.jetty.util.log.Log.ignore')
or
starts-with(@Image, 'org.eclipse.jetty.util.log.Log.info')
or
starts-with(@Image, 'org.eclipse.jetty.util.log.Log.isDebugEnabled')
or
starts-with(@Image, 'org.eclipse.jetty.util.log.Log.warn')
]
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
public void doSomething() {
Log.debug("Something happened"); // Not good
}
]]>
</example>
</rule>
</ruleset>
|