2 new revisions:
Revision: 4618e63f5dc9
Branch: default
Author: Michal Kotelba <
michal....@esacinc.com>
Date: Thu Jun 5 19:29:15 2014 UTC
Log: - Supports DCDT-157....
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=4618e63f5dc9
Revision: 61583634dca2
Branch: default
Author: Michal Kotelba <
michal....@esacinc.com>
Date: Sun Jun 8 00:00:00 2014 UTC
Log: - Further supports DCDT-157....
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=61583634dca2
==============================================================================
Revision: 4618e63f5dc9
Branch: default
Author: Michal Kotelba <
michal....@esacinc.com>
Date: Thu Jun 5 19:29:15 2014 UTC
Log: - Supports DCDT-157.
- Added initial PMD ruleset + FindBugs exclude filter files that suppress
all existing violations (until they can be reviewed in detail).
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=4618e63f5dc9
Added:
/dcdt-core/src/findbugs/filter-exclude-core.xml
/dcdt-core/src/pmd/ruleset-java-core.xml
Modified:
/dcdt-parent/pom.xml
=======================================
--- /dev/null
+++ /dcdt-core/src/findbugs/filter-exclude-core.xml Thu Jun 5 19:29:15
2014 UTC
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<FindBugsFilter>
+ <!--
+ * Reference:
http://findbugs.sourceforge.net/manual/filter.html
+ * Uses bug patterns/codes from:
http://findbugs.sourceforge.net/bugDescriptions.html
+ -->
+
+ <Match>
+ <Bug
code="BC,DP,DLS,Dm,EC,EI,EI2,Eq,FS,IS,MF,NP,PZLA,REC,Se,SF,SIC,SnVI,STCAL,UPM,UrF,UuF,UwF,WMI"/>
+ </Match>
+</FindBugsFilter>
=======================================
--- /dev/null
+++ /dcdt-core/src/pmd/ruleset-java-core.xml Thu Jun 5 19:29:15 2014 UTC
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="ruleset-core"
+ xmlns="
http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+
http://pmd.sourceforge.net/ruleset/2.0.0
http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+
+ <description>
+ PMD Java rule set for common components.
+ </description>
+
+
<!--====================================================================================================
+ = RULES: UNNECESSARY
+
=====================================================================================================-->
+ <rule ref="rulesets/java/unnecessary.xml">
+ <exclude name="UselessParentheses"/>
+ </rule>
+
+
<!--====================================================================================================
+ = RULES: UNUSED CODE
+
=====================================================================================================-->
+ <rule ref="rulesets/java/unusedcode.xml">
+ <exclude name="UnusedLocalVariable"/>
+ <exclude name="UnusedModifier"/>
+ <exclude name="UnusedPrivateField"/>
+ <exclude name="UnusedPrivateMethod"/>
+ </rule>
+</ruleset>
=======================================
--- /dcdt-parent/pom.xml Sun May 25 10:47:16 2014 UTC
+++ /dcdt-parent/pom.xml Thu Jun 5 19:29:15 2014 UTC
@@ -1703,12 +1703,13 @@
<artifactId>maven-pmd-plugin</artifactId>
<version>3.1</version>
<configuration>
+ <includeTests>true</includeTests>
<includeXmlInSite>true</includeXmlInSite>
- <includeTests>true</includeTests>
- <printFailingErrors>true</printFailingErrors>
+ <minimumTokens>200</minimumTokens>
<skipEmptyReport>false</skipEmptyReport>
+ <skipPmdError>false</skipPmdError>
+ <targetJdk>${project.java.version}</targetJdk>
<typeResolution>true</typeResolution>
- <verbose>true</verbose>
</configuration>
<reportSets>
<reportSet>
@@ -1718,6 +1719,9 @@
<report>cpd</report>
</reports>
<configuration>
+ <rulesets>
+
<ruleset>${project.basedir.all}/dcdt-core/src/pmd/ruleset-java-core.xml</ruleset>
+ </rulesets>
<skip>${project.build.sourceDirectoryNotExists}</skip>
</configuration>
</reportSet>
@@ -1726,11 +1730,14 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
- <version>2.5.3</version>
+ <version>2.5.4</version>
<configuration>
<effort>Max</effort>
+
<excludeFilterFile>${project.basedir.all}/dcdt-core/src/findbugs/filter-exclude-core.xml</excludeFilterFile>
<includeTests>true</includeTests>
- <jvmArgs>-XX:PermSize=64m -XX:MaxPermSize=128m
-XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:ParallelGCThreads=4
-XX:ConcGCThreads=4</jvmArgs>
+ <jvmArgs>
+ -XX:PermSize=64m -XX:MaxPermSize=128m
-XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:ParallelGCThreads=4
-XX:ConcGCThreads=4
+ </jvmArgs>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
</configuration>
==============================================================================
Revision: 61583634dca2
Branch: default
Author: Michal Kotelba <
michal....@esacinc.com>
Date: Sun Jun 8 00:00:00 2014 UTC
Log: - Further supports DCDT-157.
- Implemented Ant-based FindBugs analysis results checking + build failure.
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=61583634dca2
Added:
/dcdt-core/src/findbugs/findbugs-results.xsl
/dcdt-core/src/main/scripts/ant-findbugs.xml
/dcdt-core/src/main/scripts/antlib-findbugs.xml
Modified:
/dcdt-core/src/findbugs/filter-exclude-core.xml
/dcdt-parent/pom.xml
=======================================
--- /dev/null
+++ /dcdt-core/src/findbugs/findbugs-results.xsl Sun Jun 8 00:00:00 2014
UTC
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="2.0"
+ xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
+
+ <xsl:template name="bug">
+ <xsl:param name="bugNode"/>
+ <xsl:param name="bugIndex"/>
+ <xsl:element name="bug{$bugIndex}">
+ <category><xsl:value-of
select="$bugNode/@category"/></category>
+ <line><xsl:value-of select="$bugNode/@lineNumber"/></line>
+ <msg><xsl:value-of select="$bugNode/@message"/></msg>
+ <priority><xsl:value-of
select="$bugNode/@priority"/></priority>
+ <type><xsl:value-of select="$bugNode/@type"/></type>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="file">
+ <xsl:param name="fileNode"/>
+ <xsl:param name="fileIndex"/>
+ <xsl:element name="file{$fileIndex}">
+ <class><xsl:value-of select="$fileNode/@classname"/></class>
+ <xsl:element name="bugs">
+ <xsl:attribute name="num"><xsl:value-of
select="count($fileNode/BugInstance)"/></xsl:attribute>
+ <xsl:for-each select="$fileNode/BugInstance">
+ <xsl:call-template name="bug">
+ <xsl:with-param name="bugNode" select="current()"/>
+ <xsl:with-param name="bugIndex"
select="position()"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="bugs">
+ <xsl:param name="bugsNode"/>
+ <effort><xsl:value-of select="$bugsNode/@effort"/></effort>
+ <threshold><xsl:value-of
select="$bugsNode/@threshold"/></threshold>
+ <xsl:element name="files">
+ <xsl:attribute name="num"><xsl:value-of
select="count($bugsNode/file)"/></xsl:attribute>
+ <xsl:for-each select="$bugsNode/file">
+ <xsl:call-template name="file">
+ <xsl:with-param name="fileNode" select="current()"/>
+ <xsl:with-param name="fileIndex" select="position()"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="/">
+ <findbugs>
+ <results>
+ <xsl:call-template name="bugs">
+ <xsl:with-param name="bugsNode"
select="/BugCollection"/>
+ </xsl:call-template>
+ </results>
+ </findbugs>
+ </xsl:template>
+</xsl:stylesheet>
=======================================
--- /dev/null
+++ /dcdt-core/src/main/scripts/ant-findbugs.xml Sun Jun 8 00:00:00 2014
UTC
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="findbugs"
+ xmlns:dcdt="antlib:gov.hhs.onc.dcdt.ant"
+ xmlns:dcdt-findbugs="antlib:gov.hhs.onc.dcdt.ant.findbugs">
+
+ <description>Ant project for Direct Certificate Discovery Tool (DCDT)
FindBugs usage.</description>
+
+ <import
file="${project.basedir.all}/dcdt-core/src/main/scripts/ant-project.xml"
as="" prefixSeparator=""/>
+
+ <taskdef
file="${project.basedir.all}/dcdt-core/src/main/scripts/antlib-findbugs.xml"
uri="antlib:gov.hhs.onc.dcdt.ant.findbugs"/>
+
+ <target name="findbugs-check" description="Checks whether the FindBugs
analysis results file contains any bugs." depends="core-init">
+ <if>
+ <available file="${project.build.findbugsResultsFile}"
type="file"/>
+ <then>
+ <dcdt-findbugs:process-results
resultsFile="${project.build.findbugsResultsFile}"
+
resultsPropsFile="${project.build.findbugsResultsPropertiesFile}"
+
resultsStyleFile="${project.basedir.all}/dcdt-core/src/findbugs/findbugs-results.xsl"/>
+
+ <if>
+ <isgreaterthan
arg1="${project.findbugs.results.files.num}" arg2="0"/>
+ <then>
+ <var name="project.findbugs.results.bugs.num"
value="0"/>
+ <propertyselector
property="findbugs-check.files.props" override="true"
match="^(project\.findbugs\.results\.files\.file\d+)\.[^$]+$"
+ select="\1" distinct="true"/>
+ <for list="${findbugs-check.files.props}"
param="findbugs-check.file.prop">
+ <sequential>
+ <math
result="project.findbugs.results.bugs.num" datatype="int" operation="+"
operand1="${project.findbugs.results.bugs.num}"
+
operand2="${@{findbugs-check.file.prop}.bugs.num}"/>
+ <dcdt:error>Class
(name=${@{findbugs-check.file.prop}.class}) contains
${@{findbugs-check.file.prop}.bugs.num} bug(s):</dcdt:error>
+ <propertyselector
property="findbugs-check.file.bugs.props" override="true"
+
match="^(\Q@{findbugs-check.file.prop}\E\.bugs\.bug\d+)\.[^$]+$"
select="\1" distinct="true"/>
+ <for
list="${findbugs-check.file.bugs.props}"
param="findbugs-check.file.bug.prop">
+ <sequential>
+ <dcdt:error>Bug
(line=${@{findbugs-check.file.bug.prop}.line},
priority=${@{findbugs-check.file.bug.prop}.priority},
category=${@{findbugs-check.file.bug.prop}.category},
type=${@{findbugs-check.file.bug.prop}.type}):
${@{findbugs-check.file.bug.prop}.msg}</dcdt:error>
+ </sequential>
+ </for>
+ </sequential>
+ </for>
+ <fail>FindBugs analysis
(effort=${project.findbugs.results.effort},
threshold=${project.findbugs.results.threshold}) results contain
${project.findbugs.results.bugs.num} bug(s) in
${project.findbugs.results.files.num} file(s).</fail>
+ </then>
+ <else>
+ <dcdt:info>FindBugs analysis
(effort=${project.findbugs.results.effort},
threshold=${project.findbugs.results.threshold}) results do not contain any
bugs.</dcdt:info>
+ </else>
+ </if>
+ </then>
+ <else>
+ <dcdt:info>Skipping checking of FindBugs analysis
results.</dcdt:info>
+ </else>
+ </if>
+ </target>
+</project>
=======================================
--- /dev/null
+++ /dcdt-core/src/main/scripts/antlib-findbugs.xml Sun Jun 8 00:00:00
2014 UTC
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<antlib
+ xmlns:current="ant:current"
+ xmlns:dcdt="antlib:gov.hhs.onc.dcdt.ant">
+
+ <macrodef name="process-results" description="Processes a FindBugs
analysis results file.">
+ <attribute name="resultsFile"/>
+ <attribute name="resultsPropsFile"/>
+ <attribute name="resultsStyleFile"/>
+ <attribute name="prefix" default="project.findbugs"/>
+ <sequential>
+ <xslt in="@{resultsFile}" out="@{resultsPropsFile}"
style="@{resultsStyleFile}"/>
+ <xmlproperty file="@{resultsPropsFile}" prefix="@{prefix}"
keepRoot="false" collapseAttributes="true" delimiter="|"/>
+ </sequential>
+ </macrodef>
+</antlib>
=======================================
--- /dcdt-core/src/findbugs/filter-exclude-core.xml Thu Jun 5 19:29:15
2014 UTC
+++ /dcdt-core/src/findbugs/filter-exclude-core.xml Sun Jun 8 00:00:00
2014 UTC
@@ -5,7 +5,193 @@
* Uses bug patterns/codes from:
http://findbugs.sourceforge.net/bugDescriptions.html
-->
+
<!--====================================================================================================
+ = MATCH BUG CODES: UNUSED
+
=====================================================================================================-->
<Match>
- <Bug
code="BC,DP,DLS,Dm,EC,EI,EI2,Eq,FS,IS,MF,NP,PZLA,REC,Se,SF,SIC,SnVI,STCAL,UPM,UrF,UuF,UwF,WMI"/>
+ <Bug code="UPM"/>
+ </Match>
+ <Match>
+ <Bug code="UrF"/>
+ </Match>
+ <Match>
+ <Bug code="UuF"/>
+ </Match>
+ <Match>
+ <Bug code="UwF"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: BAD CORRECTNESS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS"/>
+ </Match>
+ <Match>
+ <Bug pattern="BC_UNCONFIRMED_CAST"/>
+ </Match>
+ <Match>
+ <Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: DEAD LOCAL STORE
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="DLS_DEAD_LOCAL_STORE"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: DEFAULT METHODS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Bug pattern="DM_DEFAULT_ENCODING"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: EQUALS CALLS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="EC_UNRELATED_TYPES"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: EXPOSE INTERNALS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: EQUALS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: INCORRECT SYNCHRONIZATION
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="IS2_INCONSISTENT_SYNC"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: LAZY INITIALIZATION
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="LI_LAZY_INIT_UPDATE_STATIC"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: MASKS FIELD
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="MF_CLASS_MASKS_FIELD"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: MALICIOUS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="MS_PKGPROTECT"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: NULL PROBLEMS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION"/>
+ </Match>
+ <Match>
+ <Bug pattern="NP_NULL_ON_SOME_PATH"/>
+ </Match>
+ <Match>
+ <Bug
pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: PREFER ZERO LENGTH ARRAYS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: REDUNDANT CHECK NULL
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: RUNTIME EXCEPTIONS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="REC_CATCH_EXCEPTION"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: SERIALIZATION
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="SE_BAD_FIELD"/>
+ </Match>
+ <Match>
+ <Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
+ </Match>
+ <Match>
+ <Bug pattern="SE_NO_SERIALVERSIONID"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: SWITCH STATEMENT FALL THROUGH
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="SF_SWITCH_NO_DEFAULT"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: STATIC INNER CLASS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="SIC_INNER_SHOULD_BE_STATIC"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: STATIC
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: STATIC CALLS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="STCAL_INVOKE_ON_STATIC_DATE_FORMAT_INSTANCE"/>
+ </Match>
+ <Match>
+ <Bug pattern="STCAL_STATIC_SIMPLE_DATE_FORMAT_INSTANCE"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: VARIABLE ARGUMENTS
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/>
+ </Match>
+
+
<!--====================================================================================================
+ = MATCH BUGS: WRONG MAP ITERATOR
+
=====================================================================================================-->
+ <Match>
+ <Bug pattern="WMI_WRONG_MAP_ITERATOR"/>
</Match>
</FindBugsFilter>
=======================================
--- /dcdt-parent/pom.xml Thu Jun 5 19:29:15 2014 UTC
+++ /dcdt-parent/pom.xml Sun Jun 8 00:00:00 2014 UTC
@@ -57,6 +57,9 @@
<project.build.cloverOutputDirectory>${project.build.cloverDirectory}/classes-instrumented</project.build.cloverOutputDirectory>
<project.build.cloverPomPropertiesFile>${project.build.directory}/maven/pom-clover.properties</project.build.cloverPomPropertiesFile>
<project.build.cloverSourceDirectory>${project.build.cloverDirectory}/src-instrumented</project.build.cloverSourceDirectory>
+ <!-- Project build FindBugs properties -->
+
<project.build.findbugsResultsFile>${project.build.directory}/findbugs.xml</project.build.findbugsResultsFile>
+
<project.build.findbugsResultsPropertiesFile>${project.build.directory}/findbugs-properties.xml</project.build.findbugsResultsPropertiesFile>
<!-- Project build POM properties -->
<project.build.pomPropertiesFile>${project.build.directory}/maven/pom.properties</project.build.pomPropertiesFile>
<!-- Project build POM source properties -->
@@ -1664,6 +1667,42 @@
</target>
</configuration>
</execution>
+ <execution>
+ <id>findbugs-check</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <inherited>true</inherited>
+ <configuration>
+ <target>
+ <ant
antfile="${project.basedir.all}/dcdt-core/src/main/scripts/ant-findbugs.xml"
target="findbugs-check"
+ inheritRefs="true"
useNativeBasedir="true"/>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>3.1</version>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <id>pmd-check</id>
+ <goals>
+ <goal>check</goal>
+ <goal>cpd-check</goal>
+ </goals>
+ <inherited>true</inherited>
+ <configuration>
+
<printFailingErrors>true</printFailingErrors>
+
<skip>${project.build.sourceDirectoryNotExists}</skip>
+
<targetDirectory>${project.reporting.outputDirectory}</targetDirectory>
+ <verbose>true</verbose>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>