[jsword-svn] jsword-support/tools/pmd s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sat Dec 31 20:08:59 MST 2005


Update of /cvs/jsword/jsword-support/tools/pmd
In directory www.crosswire.org:/tmp/cvs-serv15114/tools/pmd

Modified Files:
	build.xml ruleset.xml 
Added Files:
	pmd-report-per-class.xslt 
Log Message:
Updated tooling (Note could not upgrade checkstyle)

Index: ruleset.xml
===================================================================
RCS file: /cvs/jsword/jsword-support/tools/pmd/ruleset.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ruleset.xml	16 Aug 2005 18:03:04 -0000	1.1
--- ruleset.xml	1 Jan 2006 03:08:57 -0000	1.2
***************
*** 4,9 ****
    <description>A fairly global ruleset containing almost everything</description>
  
!   <!-- <rule ref="rulesets/basic.xml/EmptyCatchBlock"/> done better by checkstyle -->
!   <!-- <rule ref="rulesets/basic.xml/EmptyIfStmt"/> done better by checkstyle -->
    <rule ref="rulesets/basic.xml/EmptyWhileStmt"/>
    <rule ref="rulesets/basic.xml/EmptyTryBlock"/>
--- 4,9 ----
    <description>A fairly global ruleset containing almost everything</description>
  
!   <rule ref="rulesets/basic.xml/EmptyCatchBlock"/>
!   <rule ref="rulesets/basic.xml/EmptyIfStmt"/>
    <rule ref="rulesets/basic.xml/EmptyWhileStmt"/>
    <rule ref="rulesets/basic.xml/EmptyTryBlock"/>
***************
*** 22,30 ****
    <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
    <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
  
!   <!-- <rule ref="rulesets/naming.xml/ShortVariable"/> 687 reports -->
!   <!-- <rule ref="rulesets/naming.xml/LongVariable"/> 668 reports -->
    <rule ref="rulesets/naming.xml/ShortMethodName"/>
!   <!-- <rule ref="rulesets/naming.xml/VariableNamingConventions"/> 159 reports -->
    <rule ref="rulesets/naming.xml/MethodNamingConventions"/>
    <rule ref="rulesets/naming.xml/ClassNamingConventions"/>
--- 22,35 ----
    <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
    <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+   <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+   <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+   <rule ref="rulesets/basic.xml/UselessOverridingMethod"/>
+   <rule ref="rulesets/basic.xml/ClassCastExceptionWithToArray"/>
+   <rule ref="rulesets/basic.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
  
!   <!-- <rule ref="rulesets/naming.xml/ShortVariable"/> 646 reports -->
!   <!-- <rule ref="rulesets/naming.xml/LongVariable"/> 127 reports -->
    <rule ref="rulesets/naming.xml/ShortMethodName"/>
!   <rule ref="rulesets/naming.xml/VariableNamingConventions"/>
    <rule ref="rulesets/naming.xml/MethodNamingConventions"/>
    <rule ref="rulesets/naming.xml/ClassNamingConventions"/>
***************
*** 35,42 ****
    <rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>
    <rule ref="rulesets/naming.xml/SuspiciousEqualsMethodName"/>
  
    <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
    <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
!   <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/> Buggy -->
    <rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
  
--- 40,53 ----
    <rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>
    <rule ref="rulesets/naming.xml/SuspiciousEqualsMethodName"/>
+   <rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>
+   <rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>
+   <rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>
+   <rule ref="rulesets/naming.xml/NoPackage"/>
+   <rule ref="rulesets/naming.xml/PackageCase"/>
+   <rule ref="rulesets/naming.xml/MisleadingVariableName"/>
  
    <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
    <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
!   <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
    <rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
  
***************
*** 45,55 ****
    <rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
    <rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>
!   <!-- <rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/> 6 reports -->
!   <!-- <rule ref="rulesets/design.xml/AvoidReassigningParameters"/> 33 infringements, but silly fixing -->
    <rule ref="rulesets/design.xml/SwitchDensity"/>
!   <!-- <rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/> 41 infringements, might be worth working through -->
    <rule ref="rulesets/design.xml/AccessorClassGeneration"/>
    <rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>
!   <rule ref="rulesets/design.xml/CloseConnection"/>
    <rule ref="rulesets/design.xml/NonStaticInitializer"/>
    <rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>
--- 56,66 ----
    <rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
    <rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>
!   <!-- <rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/> 8 reports -->
!   <rule ref="rulesets/design.xml/AvoidReassigningParameters"/>
    <rule ref="rulesets/design.xml/SwitchDensity"/>
!   <rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
    <rule ref="rulesets/design.xml/AccessorClassGeneration"/>
    <rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>
!   <rule ref="rulesets/design.xml/CloseResource"/>
    <rule ref="rulesets/design.xml/NonStaticInitializer"/>
    <rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>
***************
*** 62,69 ****
    <rule ref="rulesets/design.xml/IdempotentOperations"/>
    <rule ref="rulesets/design.xml/SimpleDateFormatNeedsLocale"/>
!   <!-- <rule ref="rulesets/design.xml/ImmutableField"/> 257 reports. -->
    <rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>
    <rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
    <rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>
  
    <rule ref="rulesets/imports.xml/DuplicateImports"/>
--- 73,93 ----
    <rule ref="rulesets/design.xml/IdempotentOperations"/>
    <rule ref="rulesets/design.xml/SimpleDateFormatNeedsLocale"/>
!   <!-- <rule ref="rulesets/design.xml/ImmutableField"/> 236 reports. -->
    <rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>
    <rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
    <rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>
+   <!-- <rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/> 29 reports -->
+   <!-- <rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/> 106 reports -->
+   <rule ref="rulesets/design.xml/MissingBreakInSwitch"/>
+   <rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>
+   <rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>
+   <rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>
+   <rule ref="rulesets/design.xml/SimplifyConditional"/>
+   <rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>
+   <rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+   <rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+   <rule ref="rulesets/design.xml/NonThreadSafeSingleton"/>
+   <!-- <rule ref="rulesets/design.xml/UncommentedEmptyMethod"/> 53 reports -->
+   <!-- <rule ref="rulesets/design.xml/UncommentedEmptyConstructor"/> 188 reports -->
  
    <rule ref="rulesets/imports.xml/DuplicateImports"/>
***************
*** 77,86 ****
    <rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>
    <rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>
  -->
  
!   <!-- <rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/> 2 reports, but silly fixing -->
!   <!-- <rule ref="rulesets/strings.xml/StringInstantiation"/> 5 reports. PasswordField new String(getPassword()) -->
    <rule ref="rulesets/strings.xml/StringToString"/>
!   <rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>
  
    <rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>
--- 101,116 ----
    <rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>
    <rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>
+   <rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>
+   <rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>
+   <rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>
+   <rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>
  -->
  
!   <rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>
!   <rule ref="rulesets/strings.xml/StringInstantiation"/>
    <rule ref="rulesets/strings.xml/StringToString"/>
!   <rule ref="rulesets/strings.xml/InefficientStringBuffering"/>
!   <rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>
!   <rule ref="rulesets/strings.xml/UseStringBufferLength"/>
  
    <rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>
***************
*** 91,137 ****
    <!-- <rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/> 8 reports. -->
    <rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
!   <!-- <rule ref="rulesets/codesize.xml/ExcessiveClassLength"/> 3 reports. -->
!   <!-- <rule ref="rulesets/codesize.xml/CyclomaticComplexity"/> 40 reports, maybe check comments? -->
    <rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>
  
!   <!-- <rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/> 652 reports. -->
    <rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>
    <rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>
    <rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>
    <rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>
-   <rule ref="rulesets/finalizers.xml/ExplicitCallToFinalize"/>
    <rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>
  
    <rule ref="rulesets/clone.xml/ProperCloneImplementation"/>
!   <!-- try me <rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/> -->
!   <!-- try me <rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/> -->
  
!   <!-- <rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/> 13 reports, but silly fixing-->
!   <!-- <rule ref="rulesets/coupling.xml/ExcessiveImports"/> 12 reports. -->
    <rule ref="rulesets/coupling.xml/LooseCoupling"/>
  
    <rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>
!   <!-- <rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/> 3 reports. -->
!   <rule ref="rulesets/strictexception.xml/ExceptionTypeChecking"/>
    <rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>
!   <!-- <rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/> 4 reports. -->
!   <!-- <rule ref="rulesets/strictexception.xml/AvoidThrowingCertainExceptionTypes"/> 10 reports -->
  
!   <!-- <rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/> Not written very well. -->
!   <!-- <rule ref="rulesets/controversial.xml/NullAssignment"/> 68 reports -->
!   <!-- <rule ref="rulesets/controversial.xml/OnlyOneReturn"/> 558 reports -->
!   <!-- <rule ref="rulesets/controversial.xml/UnusedModifier"/> 197 reports -->
    <rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
!   <!-- <rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/> 149 reports -->
    <rule ref="rulesets/controversial.xml/DontImportSun"/>
    <rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>
  
    <!-- <rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/> Not written very well. -->
    <!-- <rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/> Not very smart. -->
    <!-- <rule ref="rulesets/logging-java.xml/SystemPrintln"/> 17 reports in APIExamples. But, way too slow. 5+ minutes.-->
    
!   <!-- <rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/> 2171 reports! -->
!   <!-- <rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/> 2359 reports! -->
!   <!-- <rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/> 88 reports. -->
    
  </ruleset>
--- 121,179 ----
    <!-- <rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/> 8 reports. -->
    <rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
!   <!-- <rule ref="rulesets/codesize.xml/ExcessiveClassLength"/> 5 reports. -->
!   <!-- <rule ref="rulesets/codesize.xml/CyclomaticComplexity"/> 41 reports, maybe check comments? -->
    <rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>
+   <rule ref="rulesets/codesize.xml/TooManyFields"/>
  
!   <!-- <rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/> 585 reports -->
!   <rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>
    <rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>
    <rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>
    <rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>
    <rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>
    <rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>
+   <rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>
  
    <rule ref="rulesets/clone.xml/ProperCloneImplementation"/>
!   <rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>
!   <rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>
  
!   <rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>
!   <rule ref="rulesets/coupling.xml/ExcessiveImports"/>
    <rule ref="rulesets/coupling.xml/LooseCoupling"/>
  
    <rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>
!   <rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>
    <rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>
!   <rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>
!   <rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>
!   <rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>
  
!   <rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>
!   <!-- <rule ref="rulesets/controversial.xml/NullAssignment"/> 61 reports -->
!   <!-- <rule ref="rulesets/controversial.xml/OnlyOneReturn"/> 506 reports -->
!   <rule ref="rulesets/controversial.xml/UnusedModifier"/>
    <rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
!   <!-- <rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/> 142 reports -->
    <rule ref="rulesets/controversial.xml/DontImportSun"/>
    <rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>
+   <!-- <rule ref="rulesets/controversial.xml/CallSuperInConstructor"/> 231 reports -->
+   <rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+   <!-- <rule ref="rulesets/controversial.xml/SingularField"/> 65 reports -->
+   <!-- <rule ref="rulesets/controversial.xml/DefaultPackage"/> 355 reports -->
  
    <!-- <rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/> Not written very well. -->
    <!-- <rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/> Not very smart. -->
    <!-- <rule ref="rulesets/logging-java.xml/SystemPrintln"/> 17 reports in APIExamples. But, way too slow. 5+ minutes.-->
+   <rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>
+ 
+   <rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>
+   <rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>
    
!   <!-- <rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/> 21117 reports! -->
!   <!-- <rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/> 1908 reports! -->
!   <!-- <rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/> 70 reports. -->
    
+   <rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>
+   <rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>
  </ruleset>

Index: build.xml
===================================================================
RCS file: /cvs/jsword/jsword-support/tools/pmd/build.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** build.xml	16 Aug 2005 18:03:04 -0000	1.1
--- build.xml	1 Jan 2006 03:08:57 -0000	1.2
***************
*** 1,4 ****
--- 1,7 ----
  <project name="pmd" default="pmd">
  
+   <property name="pmd" value="${support.tools}/pmd"/>
+   <property name="version.pmd" value="3.4"/>
+ 
    <!-- this should be overridden by the parent file -->
    <property name="support.tools" value=".."/>
***************
*** 6,10 ****
    <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
  	<classpath>
! 	  <fileset dir="${support.tools}/pmd" includes="**/*.jar"/>
  	</classpath>
    </taskdef>
--- 9,13 ----
    <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
  	<classpath>
! 	  <fileset dir="${pmd}/pmd-${version.pmd}" includes="*/*.jar"/>
  	</classpath>
    </taskdef>
***************
*** 12,21 ****
    <target name="pmd">
      <mkdir dir="${target.web}/pmd"/>
!     <pmd rulesetfiles="${basedir}/${support.tools}/pmd/ruleset.xml" shortFilenames="true">
!       <formatter type="html" toFile="${target.web}/pmd/index.html"/>
        <fileset dir="..">
          <patternset refid="pattern.alljava"/>
        </fileset>
      </pmd>
    </target>
  
--- 15,35 ----
    <target name="pmd">
      <mkdir dir="${target.web}/pmd"/>
!     <!--
!     <pmd rulesetfiles="${basedir}/${pmd}/ruleset.xml" shortFilenames="true">
!       <formatter type="xml" toFile="${target.web}/pmd/report_pmd.xml"/>
        <fileset dir="..">
          <patternset refid="pattern.alljava"/>
        </fileset>
      </pmd>
+     -->
+     <xslt in="${target.web}/pmd/report_pmd.xml"
+           style="${pmd}/pmd-${version.pmd}/etc/xslt/wz-pmd-report.xslt"
+           out="${target.web}/pmd/wz-report_pmd.html" />
+     <xslt in="${target.web}/pmd/report_pmd.xml"
+           style="${pmd}/pmd-${version.pmd}/etc/xslt/pmd-report.xslt"
+           out="${target.web}/pmd/report_pmd.html" />
+     <xslt in="${target.web}/pmd/report_pmd.xml"
+           style="${pmd}/pmd-report-per-class.xslt"
+           out="${target.web}/pmd/report_pmd_per_class.html" />
    </target>
  

--- NEW FILE: pmd-report-per-class.xslt ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Header: /cvs/jsword/jsword-support/tools/pmd/pmd-report-per-class.xslt,v 1.1 2006/01/01 03:08:57 dmsmith Exp $ -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" 
	doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes"/>

<xsl:template name="message">
<xsl:value-of disable-output-escaping="yes" select="."/>
</xsl:template>

<xsl:template name="priorityDiv">
<xsl:if test="@priority = 1">p1</xsl:if>
<xsl:if test="@priority = 2">p2</xsl:if>
<xsl:if test="@priority = 3">p3</xsl:if>
<xsl:if test="@priority = 4">p4</xsl:if>
<xsl:if test="@priority = 5">p5</xsl:if>
</xsl:template>

<xsl:template name="timestamp">
	<xsl:value-of select="substring-before(//pmd/@timestamp, 'T')"/> - <xsl:value-of select="substring-before(substring-after(//pmd/@timestamp, 'T'), '.')"/>
</xsl:template>

<xsl:key name="rules" match="violation" use="concat(@ruleset, ':', @rule)" />

<xsl:template match="pmd">
<html>
<head>
    <title>PMD <xsl:value-of select="//pmd/@version"/> Report</title>
	<script type="text/javascript" src="sorttable.js"></script>
    <style type="text/css">
        body { margin-left: 2%; margin-right: 2%; font:normal verdana,arial,helvetica; color:#000000; }
        table.sortable tr th { font-weight: bold; text-align:left; background:#a6caf0; }
        table.sortable tr td { background:#eeeee0; }
        table.classcount tr th { font-weight: bold; text-align:left; background:#a6caf0; }
        table.classcount tr td { background:#eeeee0; }
        table.summary tr th { font-weight: bold; text-align:left; background:#a6caf0; }
        table.summary tr td { background:#eeeee0; text-align:center;}
        .p1 { background:#FF9999; }
        .p2 { background:#FFCC66; }
        .p3 { background:#FFFF99; }
        .p4 { background:#99FF99; }
        .p5 { background:#9999FF; }
		div.top{text-align:right;margin:1em 0;padding:0}
		div.top div{display:inline;white-space:nowrap}
		div.top div.left{float:left}
		#content>div.top{display:table;width:100%}
		#content>div.top div{display:table-cell}
		#content>div.top div.left{float:none;text-align:left}
		#content>div.top div.right{text-align:right}
    </style>
</head>
<body>
    <H1><div class="top"><div class="left">PMD <xsl:value-of select="//pmd/@version"/> Report</div><div class="right"><xsl:call-template name="timestamp"/></div></div></H1>
    <hr/>
    <h2>Summary</h2>
    <table border="0" class="summary">
      <tr>
        <th>Files</th>
        <th>Total</th>
        <th>Priority 1</th>
        <th>Priority 2</th>
        <th>Priority 3</th>
        <th>Priority 4</th>
        <th>Priority 5</th>
      </tr>
      <tr>
        <td><xsl:value-of select="count(//file)"/></td>
        <td><xsl:value-of select="count(//violation)"/></td>
        <td><div class="p1"><xsl:value-of select="count(//violation[@priority = 1])"/></div></td>
        <td><div class="p2"><xsl:value-of select="count(//violation[@priority = 2])"/></div></td>
        <td><div class="p3"><xsl:value-of select="count(//violation[@priority = 3])"/></div></td>
        <td><div class="p4"><xsl:value-of select="count(//violation[@priority = 4])"/></div></td>
        <td><div class="p5"><xsl:value-of select="count(//violation[@priority = 5])"/></div></td>
      </tr>
    </table>
    <br/>
    <table border="0" class="sortable">
      <tr>
        <th align="center">Prio</th>
        <th align="center">Rule Set</th>
        <th align="center">Rule</th>
        <th align="center">Total</th>
      </tr>
      <xsl:for-each select="//violation[generate-id() = generate-id(key('rules', concat(@ruleset, ':', @rule))[1])]">
        <xsl:sort data-type="number" order="ascending" select="@priority"/>
        <xsl:sort select="@ruleset"/>
        <xsl:sort select="@rule"/>
        <xsl:variable name="ruleset" select="@ruleset"/>
        <xsl:variable name="rule" select="@rule"/>
        <tr>
          <td style="padding: 3px" align="right"><div><xsl:attribute name="class"><xsl:call-template name="priorityDiv"/></xsl:attribute><xsl:value-of disable-output-escaping="yes" select="@priority"/></div></td>
          <td style="padding: 3px" align="left"><xsl:value-of select="@ruleset"/></td>
          <td style="padding: 3px" align="left"><xsl:if test="@externalInfoUrl"><a><xsl:attribute name="href"><xsl:value-of select="@externalInfoUrl"/></xsl:attribute><xsl:value-of select="@rule"/></a></xsl:if><xsl:if test="not(@externalInfoUrl)"><xsl:value-of select="@rule"/></xsl:if></td>
          <td style="padding: 3px" align="right"><xsl:value-of select="count(//violation[@ruleset = $ruleset and @rule = $rule])"/></td></tr>
      </xsl:for-each>
    </table>
    <hr/>
    <xsl:for-each select="file">
        <xsl:sort data-type="number" order="descending" select="count(violation)"/>
        <xsl:variable name="filename">
          <xsl:choose>
            <xsl:when test="contains(@name, 'org')">
              <xsl:value-of select="concat('org', substring-after(@name, 'org'))"/>
            </xsl:when>
            <xsl:when test="contains(@name, 'com')">
              <xsl:value-of select="concat('com', substring-after(@name, 'com'))"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="@name"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <H3><a><xsl:attribute name="href"><xsl:value-of select="concat('../java2html/', translate($filename, '\\', '/'), '.html')"/></xsl:attribute><xsl:value-of disable-output-escaping="yes" select="substring-before(translate($filename,'/\\','..'),'.java')"/></a></H3>
        <table border="0" width="100%" class="sortable"><xsl:attribute name="id">sortable_id_<xsl:value-of select="position()"/></xsl:attribute>
            <tr>
				<th>Prio</th>
                <th>Line</th>
				<th>Method</th>
                <th align="left">Description</th>
            </tr>
	    <xsl:for-each select="violation">
		    <tr>
			<td style="padding: 3px" align="right"><div><xsl:attribute name="class"><xsl:call-template name="priorityDiv"/></xsl:attribute><xsl:value-of disable-output-escaping="yes" select="@priority"/></div></td>
			<td style="padding: 3px" align="right"><xsl:value-of disable-output-escaping="yes" select="@line"/></td>
			<td style="padding: 3px" align="left"><xsl:value-of disable-output-escaping="yes" select="@method"/></td>
			<td style="padding: 3px" align="left" width="100%"><xsl:if test="@externalInfoUrl"><a><xsl:attribute name="href"><xsl:value-of select="@externalInfoUrl"/></xsl:attribute><xsl:call-template name="message"/></a></xsl:if><xsl:if test="not(@externalInfoUrl)"><xsl:call-template name="message"/></xsl:if></td>
		    </tr>
	    </xsl:for-each>
		</table>
		
		<table border="0" width="100%" class="classcount">
			<tr>
				<th>Total number of violations for this class: <xsl:value-of select="count(violation)"/></th>
			</tr>
        </table>
        <br/>
    </xsl:for-each>
    <p>Generated by <a href="http://pmd.sourceforge.net">PMD <b><xsl:value-of select="//pmd/@version"/></b></a> on <xsl:call-template name="timestamp"/>.</p>
</body>
</html>
</xsl:template>

</xsl:stylesheet>



More information about the jsword-svn mailing list