13.7. Other developer-level build targets

This section documents a number of additional build targets of use to developers beyond the basic build (quickStart, freshStart) and test (all.junit <module>.junit) targets. These targets generate additional views of the system or perform various kinds of static analysis useful in assessing and improving the quality of the system.

Some of these tools are available immediately upon download of the system, while others require some amount of external installation. If external installation is required, this will be noted in the description.

13.7.1. Generating JavaDoc with all.javadoc, <module>.javadoc, hackyCore_Build.combined.javadoc

To generate individual JavaDoc documentation for all of the available modules, use all.javadoc. To generate a single "combined" JavaDoc for all of the available modules, use hackyCore_Build.combined.javadoc. To generate the JavaDoc documentation for a specific module, use the module-specific target. Here is an example invocation of a module-specific target:

c:\svn\hackyCore_Build>ant hackyCore_Kernel.javadoc
Buildfile: build.xml

hackyCore_Kernel.javadoc:
  [javadoc] Generating Javadoc
  [javadoc] Javadoc execution
  [javadoc] Loading source files for package org.hackystat.core.kernel.admin...
  [javadoc] Loading source files for package org.hackystat.core.kernel.alert...
  [javadoc] Loading source files for package org.hackystat.core.kernel.cache...
  [javadoc] Loading source files for package org.hackystat.core.kernel.command...
  [javadoc] Loading source files for package org.hackystat.core.kernel.evolsdt...
  [javadoc] Loading source files for package org.hackystat.core.kernel.mvc...
  [javadoc] Loading source files for package org.hackystat.core.kernel.mvc.logger...
  [javadoc] Loading source files for package org.hackystat.core.kernel.sdt...
  [javadoc] Loading source files for package org.hackystat.core.kernel.sensor...
  [javadoc] Loading source files for package org.hackystat.core.kernel.sensor.usermap...
  [javadoc] Loading source files for package org.hackystat.core.kernel.sensordata...
  [javadoc] Loading source files for package org.hackystat.core.kernel.shell...
  [javadoc] Loading source files for package org.hackystat.core.kernel.shell.command...
  [javadoc] Loading source files for package org.hackystat.core.kernel.soap...
  [javadoc] Loading source files for package org.hackystat.core.kernel.test...
  [javadoc] Loading source files for package org.hackystat.core.kernel.timer...
  [javadoc] Loading source files for package org.hackystat.core.kernel.user...
  [javadoc] Loading source files for package org.hackystat.core.kernel.util...
  [javadoc] Constructing Javadoc information...
  [javadoc] Standard Doclet version 1.4.2_03
  [javadoc] Generating C:\svn\hackyCore_Build\build\reports\javadoc\hackyCore_Kernel\constant-values.html...
  [javadoc] Copying file C:\svn\hackyCore_Build\lib\reports\reports.css to file C:\svn\hackyCore_Build\build\reports\javadoc\hackyCore_Kernel\reports.css...
  [javadoc] Building tree for all the packages and classes...
  [javadoc] Building index for all the packages and classes...
  [javadoc] Building index for all classes...

BUILD SUCCESSFUL
Total time: 6 seconds

The individually generated JavaDocs are available in hackyCore_Build/build/reports/javadoc/<module>/. The JavaDocs resulting from hackyCore_Build.combined.javadoc are available in hackyCore_Build/build/reports/combined-javadoc/. Figure 13.6, “ JavaDoc for hackyCore_Kernel ” illustrates the JavaDoc documentation generated from the Ant invocation above.

Figure 13.6.  JavaDoc for hackyCore_Kernel


JavaDoc for hackyCore_Kernel

13.7.2. Generating Checkstyle reports with all.checkstyle, <module>.checkstyle

Checkstyle is a source code format compliance checker for Java. It is used in Hackystat to ensure that the source code developed by different developers obeys a common format. In particular, Checkstyle helps ensure that JavaDoc documentation is provided for all classes and methods (although it does not, unfortunately, ensure that the JavaDoc documentation provided by developers is actually useful!)

The all.checkstyle target is invoked automatically as part of the freshStart target, and will fail the build if any formatting errors are discovered. In some cases, you may wish to manually run Checkstyle outside of the freshStart target to look for errors. Here is an example run of checkstyle using the module-level target, with a Checkstyle error introduced for illustrative purposes.

C:\svn\hackyCore_Build>ant hackyCore_Kernel.checkstyle
Buildfile: build.xml

hackyCore_Kernel.checkstyle:
[checkstyle] C:\svn\hackyCore_Kernel\src\org\hackystat\core\kernel\admin\ServerProperties.java:111: Line is longer than 100 characters.

BUILD FAILED
C:\svn\hackyCore_Kernel\local.build.xml:90: The following error occurred while executing this line:
C:\svn\hackyCore_Build\checkstyle.build.xml:18: Got 1 errors.

Total time: 5 seconds

The ASCII output from the target invocation is generally quite descriptive in what needs to be fixed to correct formatting violations, as the above run illustrates.

13.7.3. Formatting source for the web with all.java2html, <module>.java2html

Java2Html is a utility that converts Java source code to hyperlinked HTML pages with a format similar to JavaDoc. It comes in an "all" and module-specific targets. Invocation of a module-specific target looks like this:

c:\svn\hackyCore_Build>ant hackyCore_Kernel.java2html
Buildfile: build.xml

hackyCore_Kernel.java2html:
[java2html] Java2HTML Version 1.0.8
[java2html] Copyright (c) 2000 Ritelink Computing Ltd.
[java2html] New Versions available from http://www.java2html.com
[java2html] (type j2h with no arguments to get help)
[java2html] Created C:\svn\hackyCore_Build\build\reports\java2html\hackyCore_Kernel\front.html
[java2html] Created C:\svn\hackyCore_Build\build\reports\java2html\hackyCore_Kernel\stylesheet.css
[java2html] Created: C:\svn\hackyCore_Build\build\reports\java2html\hackyCore_Kernel\org\hackystat\core\kernel\util\TokenizableDataParser.java.html
[java2html] Created: C:\svn\hackyCore_Build\build\reports\java2html\hackyCore_Kernel\org\hackystat\core\kernel\evolsdt\TestEvolSdt.java.html
[java2html] Created: C:\svn\hackyCore_Build\build\reports\java2html\hackyCore_Kernel\org\hackystat\core\kernel\mvc\RequestHook.java.html
[java2html] Created: C:\svn\hackyCore_Build\build\reports\java2html\hackyCore_Kernel\org\hackystat\core\kernel\util\StringListCodecException.java.html
       :
   lots of lines of output deleted
       :
ata\SensorDataException.java.html
[java2html] Created: C:\svn\hackyCore_Build\build\reports\java2html\hackyCore_Kernel\org\hackystat\core\kernel\util\TestDay.java.html

BUILD SUCCESSFUL
Total time: 5 seconds

The generated Java2Html is available in hackyCore_Build/build/reports/java2html/<module>/. Figure 13.7, “ Java2Html for hackyCore_Kernel ” illustrates the Java2Html documentation generated from the Ant invocation above.

Figure 13.7.  Java2Html for hackyCore_Kernel


Java2Html for hackyCore_Kernel

13.7.4. Performing coverage analysis with hackyCore_Build.emma

Emma is a coverage tool for Java that computes class, method, block, and line level coverage. In Hackystat, coverage can be used as a way to evaluate the quality of test case design and implementation for modules.

The Emma coverage tool is not distributed as part of the Hackystat distribution. To run Emma over Hackystat modules, you must first download Emma 2.0.5 or later, unzip it into an appropriate directory, and copy the emma.jar file from the emma/lib/ directory to your JAVA_HOME/jre/lib/ext directory. Then, shutdown and restart your Tomcat server so that it is running with access to the emma.jar file. You must also download the Emma sensor from a Hackystat server (such as the Hackystat Public Server).

To generate the Emma coverage report for your tests over all available modules, invoke "ant -q -f emma.build.xml hackyCore_Build.emma". This non-standard invocation process is required in order to provide a special definition of the makeJUnit target for use during Emma coverage generation. The resulting output should look similar to the following:

C:\svn\hackyCore_Build>ant -q -f emma.build.xml hackyCore_Build.emma
Trying to override old definition of task makeJUnit
     [echo] (18:16:05) Completed hackyCore_Build.checkModuleAvailability
     [echo] (18:16:11) Completed hackyCore_Build.hotUndeployHackystat
     [echo] (18:16:37) Completed hackyCore_Build.clean
     [echo] (18:16:47) Completed all.compile
     [echo] (18:16:49) Completed hackyCore_Build.emma.instrument
     [echo] (18:16:56) Completed all.install.pre-sensorshell
     [echo] (18:17:15) Completed hackyCore_Build.unjarSensorShellFiles
     [echo] (18:17:17) Completed hackyCore_Build.installSensorShell
     [echo] (18:17:46) Completed all.install.post-sensorshell
     [echo] (18:17:46) Completed hackyCore_Build.deployTestData
     [echo] (18:17:56) Completed hackyCore_Build.hotDeployHackystat
     [echo] (18:17:57) Completed hackyCore_Build.deploySoap
     [echo] (18:18:07) Completed hackyCore_Kernel.junit.
     [echo] (18:18:08) Completed hackyCore_Statistics.junit.
     [echo] (18:18:17) Completed hackyCore_Report.junit.
     [echo] (18:18:21) Completed hackyCore_Common.junit.
     [echo] (18:18:26) Completed hackyCore_Telemetry.junit.
     [echo] (18:18:39) Completed hackyCore_Installer.junit.
     [echo] (18:18:39) Completed all.junitReport
     [echo] (18:18:39) Completed all.junit
     [echo] (18:18:39) Wait for coverage.ec (maximum of 60 seconds).
     [echo] (18:18:39) Completed hackyCore_Build.emmaReport.

BUILD SUCCESSFUL
Total time: 2 minutes 47 seconds

Note that the hackyCore_Build.emma target, after running all of the test cases, shuts down Tomcat using a Windows-specific Ant target. If you would like to generate Emma coverage data for Hackystat, but are running on a Unix platform, then this target will need to be conditionalized to the operating system. Let us know if you need this. The reason the target shuts Tomcat down is to ensure that Tomcat finishes writing out the coverage.ec file containing the results data.

An HTML version of the Emma report is available in hackyCore_Build/build/reports/emma/coverage/. Figure 13.8, “ Top-level Emma Report for hackyCore* configuration. ” illustrates the top-level Emma report.

Figure 13.8.  Top-level Emma Report for hackyCore* configuration.


Top-level Emma Report for hackyCore* configuration.

It is possible to drill down and see the results for individual files, including color-coding the lines that have been executed or not. Figure 13.9, “ Emma Report on an individual class ” illustrates this report.

Figure 13.9.  Emma Report on an individual class


Emma Report on an individual class

We have developed a sensor for Emma which generates Coverage sensor data, and we send Emma coverage data to the public Hackystat server each day.

13.7.5. Generating size data with all.locc, <module>.locc

LOCC is a system for counting the size of Java files. The Hackystat locc build targets allow counting of the lines of Java source code in the system as a whole or in individual modules. Here is an example invocation:

c:\svn\hackyCore_Build>ant hackyCore_Kernel.locc
Buildfile: build.xml

hackyCore_Kernel.locc:
     [locc] **************************************
     [locc] LOCC statistics for batch:
     [locc] **************************************
     [locc] Total files processed   = 113
     [locc] Total successful files  = 113
     [locc] Total files with errors = 0
     [locc] **************************************
     [locc] List of successfully processed files:
     [locc] **************************************
     [locc] C:\svn\hackyCore_Kernel\src\org\hackystat\core\kernel\admin\SensorProperties.java
     [locc] C:\svn\hackyCore_Kernel\src\org\hackystat\core\kernel\admin\ServerProperties.java
                     :
                lots of lines deleted
                     :
     [locc] C:\svn\hackyCore_Kernel\src\org\hackystat\core\kernel\util\Week.java
     [locc] **************************************
     [locc] List of files containing errors:
     [locc] **************************************
     [locc] No files containing errors in this batch.
     [locc] **************************************

BUILD SUCCESSFUL
Total time: 4 seconds
c:\svn\hackyCore_Build>

Currently, there is no HTML reporting facility associated with the LOCC system. The LOCC target is configured to generate size data in XML format for subsequent input to the LOCC hackystat sensor.

13.7.6. Performing coupling analysis with hackyCore_Build.dependencyfinder

Dependency Finder is a tool for analysis of Java programs that generates reports on package-to-package and class-to-class coupling levels. This can be useful for both understanding the system dependencies, identifying areas of complexity (as measured by high levels of coupling), and supporting perfective maintenance activities.

The DependencyFinder analysis tool is not distributed as part of the Hackystat distribution. To use this build report, you must first download Dependency Finder 1.1.0 beta2 or later, unzip it into an appropriate directory, and define the DEPENDENCYFINDER_HOME environment to point to that directory.

The target hackyCore_Build.dependencyfinder generates the dependency report over the set of all of the available modules. There are no module-level targets for this analysis. Here is an example invocation of hackyCore_Build.dependencyfinder for a configuration consisting of all of the current modules in the hackyCore subsystem.

C:\svn\hackyCore_Build>ant hackyCore_Build.dependencyfinder
Buildfile: build.xml

hackyCore_Build.dependencyfinder.report:
    [mkdir] Created dir: C:\svn\hackyCore_Build\build\reports\dependency
[dependencyextractor] Reading classes from path C:\svn\hackyCore_Build\build\war\WEB-INF\classes
[dependencyextractor] Saving dependency graph to C:\svn\hackyCore_Build\build\reports\dependency\all.xml
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\dependency\all.xml to C:\svn\hackyCore_Build\build\reports\dependency\all\index.html
     [xslt] Loading stylesheet C:\java\DependencyFinder\etc\DependencyGraphToHTML.xsl
[dependencyreporter] Reading graph from C:\svn\hackyCore_Build\build\reports\dependency\all.xml
[dependencyreporter] Saving dependency graph to C:\svn\hackyCore_Build\build\reports\dependency\class2class.xml
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\dependency\class2class.xml to C:\svn\hackyCore_Build\build\reports\dependency\class2class\index.html
     [xslt] Loading stylesheet C:\java\DependencyFinder\etc\DependencyGraphToHTML.xsl
[dependencyreporter] Reading graph from C:\svn\hackyCore_Build\build\reports\dependency\all.xml
[dependencyreporter] Saving dependency graph to C:\svn\hackyCore_Build\build\reports\dependency\package2package.xml
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\dependency\package2package.xml to C:\svn\hackyCore_Build\build\reports\dependency\package2package\index.html
     [xslt] Loading stylesheet C:\java\DependencyFinder\etc\DependencyGraphToHTML.xsl

hackyCore_Build.dependencyfinder.hackystat.sensor:

hackyCore_Build.dependencyfinder:

BUILD SUCCESSFUL
Total time: 1 minute 1 second

The generated DependencyFinder report is available in hackyCore_Build/build/reports/dependency/package2package/index.html and hackyCore_Build/build/reports/dependency/class2class/index.html. Figure 13.10, “ DependencyFinder package2package report for a hackyCore* configuration ” illustrates the DependencyFinder package2package coupling analysis generated from the Ant invocation above.

Figure 13.10.  DependencyFinder package2package report for a hackyCore* configuration


DependencyFinder package2package report for a hackyCore* configuration

We have developed a sensor for DependencyFinder and a corresponding sensor data type, and send Dependency data to the public Hackystat server each day with this report. Telemetry analyses are forthcoming.

13.7.7. Performing PMD analysis with all.pmd, <module>.pmd

PMD scans Java source code and looks for potential problems including: (a) possible bugs (empty try/catch/finally/switch statements); (b) dead code (unused local variables, parameters and private methods); (c) suboptimal code (wasteful String/StringBuffer usage); (d) overly complicated expressions (unnecessary if statements, for loops that could be while loops); and (e) duplicate code (copied/pasted code means copied/pasted bugs).

The PMD analysis tool is not distributed as part of the Hackystat distribution. To run PMD over Hackystat modules, you must first download PMD 3.4 or later, unzip it into an appropriate directory, and define the PMD_HOME environment to point to that directory. We use a custom ruleset for PMD defined in hackyCore_Build/lib/pmd/hackystat-ruleset.xml.

To generate the PMD report for all of the available modules, use all.pmd. To generate the PMD report for a specific module, use the module-specific target. Here is an example invocation of a module-specific target:

C:\svn\hackyCore_Build>ant hackySdt_Activity.pmd
Buildfile: build.xml

hackySdt_Activity.pmd:
      [pmd]
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\analysis\activetime\TestActiveTimeTrend.java        26      The String literal "Active Time Trend" appears 4 times in this file; the first occurrence is on line 26
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\analysis\projectactivetime\ProjectActiveTime.java   215     A high number of imports can indicate a high degree of coupling within an object.
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyanalysis\ActivityData.java 36  It is somewhat confusing to have a field name with the same name as a method
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyanalysis\ActivityData.java 36  It is somewhat confusing to have a field name with the same name as a method
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyanalysis\MostActiveFile.java   46      It is somewhat confusing to have a field name with the same name as a method
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyanalysis\MostActiveFile.java   46      It is somewhat confusing to have a field name with the same name as a method
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyanalysis\MostActiveFile.java   184     Avoid if (x != y) ..; else ..;
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyanalysis\MostActiveFile.java   246     Avoid concatenating nonliterals in a StringBuffer constructor or append()
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyanalysis\TestActivityData.java 27      The String literal "Checking the minute2Hours for 65 min" appears 4 times in this file; the first occurrence is on line 27
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyanalysis\TestMostActiveFile.java       77      Avoid variables with short names like i
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyproject\DailyProjectActiveTime.java    53      Avoid concatenating nonliterals in a StringBuffer constructor or append()
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyproject\DailyProjectActiveTime.java    55      Avoid concatenating nonliterals in a StringBuffer constructor or append()
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyproject\DailyProjectActiveTime.java    232     Document empty constructor
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyproject\TestDailyProjectActiveTime.java        44      JUnit assertions should include a message
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyproject\TestDailyProjectActiveTime.java        45      JUnit assertions should include a message
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyproject\TestDailyProjectActiveTime.java        50      The String literal "**/Test*" appears 6 times in this file; the first occurrence is on line 50
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\dailyproject\TestDailyProjectActiveTime.java        68      JUnit assertions should include a message
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestActiveTimeReducer.java  49      The String literal "01-Feb-2003" appears 5 times in this file; the first occurrence is on line 49
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestActiveTimeReducer.java  102     JUnit tests should include assert() or fail()
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestActiveTimeReducer.java  103     The String literal "2003" appears 4 times in this file; the first occurrence is on line 103
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestActiveTimeReducer.java  133     JUnit tests should include assert() or fail()
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestMemberActiveTimeReducer.java    105     The String literal "2003" appears 4 times in this file; the first occurrence is on line 105
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestMemberActiveTimeReducer.java    126     The String literal "false" appears 4 times in this file; the first occurrence is on line 126
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestMemberActiveTimeReducer.java    142     Avoid empty catch blocks
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestMemberActiveTimeReducer.java    152     JUnit tests should include assert() or fail()
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestWorkspaceActiveTimeReducer.java 61      JUnit tests should include assert() or fail()
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestWorkspaceActiveTimeReducer.java 62      The String literal "2003" appears 4 times in this file; the first occurrence is on line 62
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\TestWorkspaceActiveTimeReducer.java 95      JUnit tests should include assert() or fail()
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\WorkspaceActiveTimeReducer.java     29      The class 'WorkspaceActiveTimeReducer' has a Cyclomatic Complexity of 8 (Highest = 11).
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\WorkspaceActiveTimeReducer.java     49      The method 'compute' has a Cyclomatic Complexity of 11.
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\WorkspaceActiveTimeReducer.java     80      Avoid using if statements without curly braces
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\reducer\WorkspaceActiveTimeReducer.java     97      Avoid using if statements without curly braces
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\sdt\Activity.java   27      Document empty constructor
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\sdt\ActivityShellCommand.java   81  The String literal "tool" appears 4 times in this file; the first occurrence is on line 81
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\sdt\ActivityShellCommand.java   86  The String literal "Activity" appears 4 times in this file; the first occurrence is on line 86
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\sdt\ActivityType.java       13  Avoid using implementation types like 'HashMap'; use the interface instead
      [pmd] C:\svn\hackySdt_Activity\src\org\hackystat\sdt\activity\sdt\TestActivity.java       30  The String literal "Activity" appears 6 times in this file; the first occurrence is on line 30
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\pmd\hackySdt_Activity\hackySdt_Activity.xml to C:\svn\hackyCore_Build\build\reports\pmd\hackySdt_Activity\pmd-report-per-class.html
     [xslt] Loading stylesheet C:\java\pmd-3.4\etc\xslt\pmd-report-per-class.xslt
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\pmd\hackySdt_Activity\hackySdt_Activity.xml to C:\svn\hackyCore_Build\build\reports\pmd\hackySdt_Activity\pmd-report.html
     [xslt] Loading stylesheet C:\java\pmd-3.4\etc\xslt\pmd-report.xslt
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\pmd\hackySdt_Activity\hackySdt_Activity.xml to C:\svn\hackyCore_Build\build\reports\pmd\hackySdt_Activity\wz-pmd-report.html
     [xslt] Loading stylesheet C:\java\pmd-3.4\etc\xslt\wz-pmd-report.xslt

BUILD SUCCESSFUL
Total time: 11 seconds

An HTML version of the PMD report is available in hackyCore_Build/build/reports/javadoc/<module>/. Figure 13.11, “ PMD for hackyCore_Kernel ” illustrates the PMD page generated from this report.

Figure 13.11.  PMD for hackyCore_Kernel


PMD for hackyCore_Kernel

We have developed a sensor for PMD which generates CodeIssue sensor data, and we send PMD CodeIssue data to the public Hackystat server each day. Telemetry analyses are forthcoming. Unlike Checkstyle, in which we fail the build if any violations are found, we do not currently enforce PMD compliance. We would love to get there eventually.

13.7.8. Performing FindBugs analysis with hackyCore_Build.findbugs

FindBugs is a static analyzer for Java bytecode that looks for "bug patterns"---code idioms that are often indicative of errors. These idioms can result from difficult language features, misunderstood API methods, misunderstood invariants when code is modified during maintenance, and garden variety mistakes: typos, use of the wrong boolean operator, etc. Because its analysis is sometimes imprecise, FindBugs can report false warnings, which are warnings that do not indicate real errors. In practice, the rate of false warnings reported by FindBugs is generally less than 50%.

The FindBugs analysis tool is not distributed as part of the Hackystat distribution. To run FindBugs over Hackystat modules, you must first download FindBugs 0.94 or later, unzip it into an appropriate directory, and define the FINDBUGS_HOME environment to point to that directory.

FindBugs will run its analyses over all of the class files in the hackyCore_Build/build/war/WEB-INF/classes directory. Here is an example invocation of FindBugs

C:\svn\hackyCore_Build>ant hackyCore_Build.findbugs
Buildfile: build.xml

hackyCore_Build.findbugs.report:
    [mkdir] Created dir: C:\svn\hackyCore_Build\build\reports\findbugs
 [findbugs] Running FindBugs...
 [findbugs] Warnings generated: 41
 [findbugs] Output saved to C:\svn\hackyCore_Build\build\reports\findbugs/findbugs.xml
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\findbugs\findbugs.xml to C:\svn\hackyCore_Build\build\reports\findbugs\findbugs-default.html
     [xslt] Loading stylesheet C:\java\findbugs-0.9.4\src\xsl\default.xsl
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\findbugs\findbugs.xml to C:\svn\hackyCore_Build\build\reports\findbugs\findbugs-plain.html
     [xslt] Loading stylesheet C:\java\findbugs-0.9.4\src\xsl\plain.xsl
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\findbugs\findbugs.xml to C:\svn\hackyCore_Build\build\reports\findbugs\findbugs-fancy.html
     [xslt] Loading stylesheet C:\java\findbugs-0.9.4\src\xsl\fancy.xsl
     [xslt] Processing C:\svn\hackyCore_Build\build\reports\findbugs\findbugs.xml to C:\svn\hackyCore_Build\build\reports\findbugs\findbugs-summary.html
     [xslt] Loading stylesheet C:\java\findbugs-0.9.4\src\xsl\summary.xsl

hackyCore_Build.findbugs.hackystat.sensor:

hackyCore_Build.findbugs:

BUILD SUCCESSFUL
Total time: 21 seconds

FindBugs generates several versions of its report; one of which is located in hackyCore_Build/build/reports/findbugs/findbugs-fancy.html. Figure 13.12, “ FindBugs report illustration ” illustrates the FindBugs report generated by running FindBugs over a configuration containing only the hackyCore_Kernel package.

Figure 13.12.  FindBugs report illustration


FindBugs report illustration

FindBugs is similar to PMD, in that it performs static analysis, but different, in that it looks at bytecode rather than source code, and thus can find potentially different kinds of errors. We have not yet started using FindBugs reports to eliminate problems in our code.

13.7.9. Generating the DocBook documentation with hackyCore_Build.buildDocBook

To generate the Docbook documentation for all of the available modules, use hackyCore_Build.buildDocBook. Here is an example invocation

C:\svn\hackyCore_Build>ant -q hackyCore_Build.buildDocBook
    [style] Writing C:\svn\hackyCore_Build\build\war\docbook/ch01s02.html for section
    [style] Writing C:\svn\hackyCore_Build\build\war\docbook/ch01s03.html for section
    [style] Writing C:\svn\hackyCore_Build\build\war\docbook/ch01s04.html for section
             :
       lots of lines deleted
             :
    [style] Writing C:\svn\hackyCore_Build\build\war\docbook/pt03.html for part(part:devguide)
    [style] Writing C:\svn\hackyCore_Build\build\war\docbook/index.html for book
     [echo] (18:30:04) Completed hackyCore_Build.buildDocbook

BUILD SUCCESSFUL
Total time: 42 seconds
Sending build result to Hackystat server... Done!

The generated DocBook is available in hackyCore_Build/build/war/docbook/index.html. Figure 13.13, “ Docbook for hackyCore configuration ” illustrates the Docbook documentation table of contents page generated from the Ant invocation above.

Figure 13.13.  Docbook for hackyCore configuration


Docbook for hackyCore configuration

13.7.10. Determining the available modules with modules

Sometimes you may forget exactly which modules are enabled in your hackystat.build.properties. You could simply display the contents of this file. Another approach is to run the "modules" target, which lists both the set of all modules currently in your local workspace, as well as those that are currently available. Here is an example invocation, in which the available modules are specified as "ON".

c:\svn\hackyCore_Build>ant modules
Buildfile: build.xml

modules:
     [echo]    :  hackyApp_BuildAnalysis
     [echo]    :  hackyApp_Cgqm
     [echo]    :  hackyApp_Cocomo
     [echo]    :  hackyApp_Course
     [echo]    :  hackyApp_Experiment
     [echo]    :  hackyApp_Hpcs
     [echo]    :  hackyApp_Mds
     [echo]    :  hackyApp_Pri
     [echo]    :  hackyApp_PrjSize
     [echo]    :  hackyApp_Review
     [echo]    :  hackyApp_StdCmd
     [echo]    :  hackyApp_TelemetryControlCenter
     [echo]    :  hackyApp_Zorro
     [echo] ON :  hackyCore_Build
     [echo] ON :  hackyCore_Common
     [echo] ON :  hackyCore_Installer
     [echo] ON :  hackyCore_Kernel
     [echo] ON :  hackyCore_Report
     [echo] ON :  hackyCore_Statistics
     [echo] ON :  hackyCore_Telemetry
     [echo]    :  hackySdt_Activity
     [echo]    :  hackySdt_BadData
     [echo]    :  hackySdt_BuffTrans
     [echo]    :  hackySdt_Build
     [echo]    :  hackySdt_Cli
     [echo]    :  hackySdt_CodeIssue
     [echo]    :  hackySdt_Commit
     [echo]    :  hackySdt_Coverage
     [echo]    :  hackySdt_Dependency
     [echo]    :  hackySdt_DevEvent
     [echo]    :  hackySdt_FileMetric
     [echo]    :  hackySdt_Issue
     [echo]    :  hackySdt_Perf
     [echo]    :  hackySdt_ReviewActivity
     [echo]    :  hackySdt_ReviewIssue
     [echo]    :  hackySdt_UnitTest
     [echo]    :  hackySdt_WorkspaceMap
     [echo]    :  hackySensor_Ant
     [echo]    :  hackySensor_Bcml
     [echo]    :  hackySensor_Cccc
     [echo]    :  hackySensor_Checkstyle
     [echo]    :  hackySensor_Cli
     [echo]    :  hackySensor_CppUnit
     [echo]    :  hackySensor_Cvs
     [echo]    :  hackySensor_DependencyFinder
     [echo]    :  hackySensor_Eclipse
     [echo]    :  hackySensor_Emacs
     [echo]    :  hackySensor_Emma
     [echo]    :  hackySensor_FindBugs
     [echo]    :  hackySensor_JBlanket
     [echo]    :  hackySensor_JBuilder
     [echo]    :  hackySensor_JUnit
     [echo]    :  hackySensor_Jira
     [echo]    :  hackySensor_Jira2
     [echo]    :  hackySensor_Jupiter
     [echo]    :  hackySensor_LoadTest
     [echo]    :  hackySensor_Locc
     [echo]    :  hackySensor_Office
     [echo]    :  hackySensor_Pmd
     [echo]    :  hackySensor_Sclc
     [echo]    :  hackySensor_Svn
     [echo]    :  hackySensor_Vcs
     [echo]    :  hackySensor_Vim
     [echo]    :  hackySensor_VisualStudio
     [echo]    :  hackySensor_XmlSensorData

BUILD SUCCESSFUL
Total time: 3 seconds
c:\svn\hackyCore_Build>

13.7.11. Building a distribution with hackyCore_Build.dist

If you would like to manually build a distribution zip file based upon your available modules, use the hackyCore_Build.dist target. Here is an example invocation:

c:\svn\hackyCore_Build>ant hackyCore_Build.dist
Buildfile: build.xml

hackyCore_Build.warnAboutModulesFile:

checkProperties:

hackyCore_Build.checkModuleAvailability:
     [echo] (14:32:11) Completed hackyCore_Build.checkModuleAvailability

hackyCore_Build.dist.init:
    [mkdir] Created dir: C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110

hackyCore_Build.dist.copy.hackyApp_BuildAnalysis:

hackyCore_Build.dist.copy.hackyApp_Cgqm:

hackyCore_Build.dist.copy.hackyCore_Build:
    [mkdir] Created dir: C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110\hackyCore_Build
     [copy] Copying 1 file to C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110\hackyCore_Build
     [copy] Copying 708 files to C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110\hackyCore_Build

hackyCore_Build.dist.copy.hackyCore_Common:
    [mkdir] Created dir: C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110\hackyCore_Common
     [copy] Copying 1 file to C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110\hackyCore_Common

       :
    much output deleted
       :

hackyCore_Build.dist.copy:

hackyCore_Build.dist.generate:
     [copy] Copying 1 file to C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110
     [copy] Copying 25 files to C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110

run:
    [mkdir] Created dir: C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110\hackyCore_Build\build\autoconfig
     [echo] [AutoConfig] Generated modules.build.xm and sample.hackystat.build.properties.
     [copy] Copying 1 file to C:\svn\hackyCore_Build\build\dist\hackystat-test-7.2.110\hackyCore_Build
      [zip] Building zip: C:\svn\hackyCore_Build\build\reports\hackystat-test-7.2.110.zip
     [echo] (14:32:39) Completed hackyCore_Build.dist.

hackyCore_Build.dist:

BUILD SUCCESSFUL
Total time: 31 seconds

The distribution zip file is located in hackyCore_Build/build/reports/.