From: Egon W. <eg...@us...> - 2004-07-01 15:37:30
|
Update of /cvsroot/cdk/cdk/pmd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16638 Modified Files: custom.xml Added Files: customCDK.xml Log Message: Tried to create a PMD rule that checks for logger.debug statements in try-catch blocks. It's not working yet. --- NEW FILE: customCDK.xml --- <?xml version="1.0"?> <ruleset name="customNaming"> <description> This ruleset checks the CDK sources for bad code. </description> <!-- rule name="CDK_MissingLoggerStatementInCatch" message="Catched Exceptions must report to CDK's LoggingTool" class="net.sourceforge.pmd.rules.XPathRule"> <description> Detects missing LoggingTool.debug(Exception) calls in the catch blocks of try statements. The LoggingTool instance is assumed to be named logger. </description> <priority>3</priority> <properties> <property name="xpath" pluginname="true"> <value> <![CDATA[ //TryStatement[@Catch='true']//StatementExpression/PrimaryExpression[PrimaryPrefix/Name/@Image = 'logger.debug'][PrimarySuffix/Arguments//Name[@Image = ../../../../../../../../../../../../FormalParameter/VariableDeclaratorId/@Image]][count(*) = 0] ]]> </value> </property> </properties> </rule --> </ruleset> Index: custom.xml =================================================================== RCS file: /cvsroot/cdk/cdk/pmd/custom.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- custom.xml 30 Jun 2004 13:24:32 -0000 1.1 +++ custom.xml 1 Jul 2004 15:37:21 -0000 1.2 @@ -5,11 +5,21 @@ This ruleset checks the CDK sources for bad code. </description> + <!-- In the below paths, rulesets/ refers to the classpath, and the + pmd/ refers to this directory, and needs to be excluded because + the are called from ../pmd.xml --> + + <!-- The rule sets that come with PMD --> + <rule ref="rulesets/basic.xml"/> - <rule ref="pmd/customNaming.xml"/> <!-- the pmd/ in front is needed because it's started in one dir up --> + <rule ref="pmd/customNaming.xml"/> <rule ref="rulesets/unusedcode.xml"/> <rule ref="rulesets/imports.xml"/> <rule ref="rulesets/strings.xml"/> <rule ref="rulesets/codesize.xml"/> + <!-- Rules specific for CDK --> + + <rule ref="pmd/customCDK.xml"/> + </ruleset> |