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

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sun May 8 18:28:16 MST 2005


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

Added Files:
	xmlParserAPIs-2.6.2.jar pmd-report.xslt ruleset.xml 
	saxpath-1.0-fcs.jar xercesImpl-2.6.2.jar pmd-3.0.jar 
	LICENSE.txt jaxen-core-1.0-fcs.jar build.xml 
Log Message:
Moved unused code to limbo.
Upgraded support-tools: checkstyle, pmd and findbugs to most recent.
Addressed over 100 issues reported by findbugs and checkstyle.
Resulted in major refactoring of GBFFilter.
Net result is that code size is significantly smaller.

--- NEW FILE: build.xml ---
<project name="pmd" default="pmd">

  <!-- this should be overridden by the parent file -->
  <property name="support.tools" value=".."/>

  <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
	<classpath>
	  <fileset dir="${support.tools}" includes="pmd*/**/*.jar"/>
	</classpath>
  </taskdef>

  <target name="pmd">
    <mkdir dir="${target.web}/pmd"/>
    <pmd rulesetfiles="${basedir}/${support.tools}/pmd-3.0/ruleset.xml" shortFilenames="true">
      <formatter type="html" toFile="${target.web}/pmd/index.html"/>
      <fileset dir="..">
        <patternset refid="pattern.alljava"/>
      </fileset>
    </pmd>
  </target>

  <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
	<classpath>
	  <fileset dir="${support.tools}" includes="pmd*/**/*.jar"/>
	</classpath>
  </taskdef>

  <target name="cpd">
    <mkdir dir="${target.web}/cpd"/>
    <cpd minimumTokenCount="100" outputFile="${target.web}/cpd/report.txt">
      <fileset dir="..">
        <patternset refid="pattern.alljava"/>
      </fileset>
    </cpd>
  </target>

</project>

--- NEW FILE: jaxen-core-1.0-fcs.jar ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: xmlParserAPIs-2.6.2.jar ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: pmd-report.xslt ---
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name="cvsweb">http://doc.ece.uci.edu/cvs/viewcvs.cgi/Zen/packages/src/</xsl:variable>

<xsl:template match="pmd">
<html>
<head>
    <title>PMD Report</title>
    <style type="text/css">
        body { margin-left: 2%; margin-right: 2%; font:normal verdana,arial,helvetica; color:#000000; }
        table.details tr th { font-weight: bold; text-align:left; background:#a6caf0; }
        table.details 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; }                        
        
    </style>
</head>
<body>
    <H1>PMD Report</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>
    <hr/>
    <xsl:for-each select="file">
        <xsl:sort data-type="number" order="descending" select="count(violation)"/>
        <xsl:variable name="filename" select="@name"/>
        <H3><xsl:value-of disable-output-escaping="yes" select="substring-before(translate(@name,'/','.'),'.java')"/></H3>
        <table border="0" width="100%" class="details">
            <tr>
                <th>Line</th>
                <th align="left">Description</th>
            </tr>
	    
	    <xsl:for-each select="violation">
		    <tr>
			<td style="padding: 3px" align="right"><a><xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$filename"/>?annotate=HEAD#<xsl:value-of disable-output-escaping="yes" select="@line"/></xsl:attribute><xsl:value-of disable-output-escaping="yes" select="@line"/></a></td>
			<td style="padding: 3px" align="left" width="100%"><xsl:value-of disable-output-escaping="yes" select="."/></td>
		    </tr>
	    </xsl:for-each>
    
        </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:value-of select="//pmd/@timestamp"/>.</p>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

--- NEW FILE: xercesImpl-2.6.2.jar ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: ruleset.xml ---
<?xml version="1.0"?>

<ruleset name="Basic Rules">
  <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"/>
  <rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>
  <rule ref="rulesets/basic.xml/EmptySwitchStatements"/>
  <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
  <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
  <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
  <rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>
  <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
  <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
  <rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>
  <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
  <rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>
  <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
  <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"/>
  <!-- <rule ref="rulesets/naming.xml/AbstractNaming"/> Reports on JSword enumerations -->
  <rule ref="rulesets/naming.xml/AvoidDollarSigns"/>
  <rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>
  <rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>
  <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"/>

  <rule ref="rulesets/design.xml/UseSingleton"/>
  <rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
  <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"/>
  <rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>
  <rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
  <rule ref="rulesets/design.xml/BadComparison"/>
  <rule ref="rulesets/design.xml/EqualsNull"/>
  <!-- <rule ref="rulesets/design.xml/ConfusingTernary"/> allow (test ? 1 : 2) -->
  <rule ref="rulesets/design.xml/InstantiationToGetClass"/>
  <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"/>
  <rule ref="rulesets/imports.xml/DontImportJavaLang"/>
  <rule ref="rulesets/imports.xml/UnusedImports"/>
  <rule ref="rulesets/imports.xml/ImportFromSamePackage"/>

  <!-- however *test is exempt from coding conventions so these are not run
  <rule ref="rulesets/junit.xml/JUnitStaticSuite"/>
  <rule ref="rulesets/junit.xml/JUnitSpelling"/>
  <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"/>
  <rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>
  <rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>
  <rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>

  <!-- <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>

--- NEW FILE: pmd-3.0.jar ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: saxpath-1.0-fcs.jar ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: LICENSE.txt ---
Copyright (c) 2003, InfoEther, LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

    * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
    * The end-user documentation included with the redistribution, if
any, must include the following acknowledgement:
      "This product includes software developed in part by support from
the Defense Advanced Research Project Agency (DARPA)"
    * Neither the name of InfoEther, LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


More information about the jsword-svn mailing list