| <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| <ruleset name="Custom PMD Ruleset" |
| xmlns="http://pmd.sf.net/ruleset/2.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/2.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" |
| language="java" |
| message="Use named logging, not anonymous" |
| class="net.sourceforge.pmd.lang.rule.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> |