General

General
What is metacheck?

Metacheck is a utility to parse results from several java source code checkers, write each of them to a uniform file structure and to write a combined meta result set.

What is metacheck not?

Metacheck is not a source code checking tool. It just parses results from other code checking tools.

Why was metacheck created?

Many java code checkers exist which all check different types of errors and present the results all in a different way. In a presentation of some members of the findbugs-team, pdf, it was suggested to create a meta tool that combines the output of various tools together. For a java/j2ee project of our own we were doing some research on code checking tools, the suggestion about the meta tool was adopted and implemented. Much inspiration on how to save the data came grom the jcsc code checking tool (with only a few minor changes). Finally the css stylesheets of maven are used.

How is metacheck implemented?

Metacheck is written in java, has resources (xsl, css and images) for the generated reports, maven and ant build scripts, and an analyse.xml ant script to do the analysis and styling.

As metacheck was written in java, it can run on most platforms and environments, we have it running on Solaris, Linux and win2k.

Which are metacheck's main features?

Main features:

  • Uniform presentation of code checking results.
  • Generate meta results to combine results from the various checkers.
  • Stylesheets can be modified to your own projects style.
  • Easily extendible to other code checking tools.
  • Could be the start of code checker comparisions.

Results from which code checkers can be parsed by metacheck?

Metacheck can parse results from the following code checkers:

  1. checkstyle
  2. cpd
  3. findbugs
  4. jcsc
  5. lint4j
  6. hammurapi
  7. pmd
  8. qj-pro
  9. revjava

How To Use Metacheck

How To Use Metacheck

How do I run metacheck?

Metacheck has a number of ant tasks to style the results of each code checking tool and a summarizing task for the overview and the meta results.

Metacheck itself uses the analyse.xml ant script to generate the metacheck results for metacheck itself. The script may be used as an example on how to use each task. The script contains per code checker a clean, a start and a style target. The start-target is used to run the code checker, for small projects this will work, for larger projects it's probably better to run the code checker separately. The style-target is used to read the results from the code checker and write the to the uniform file lay-out.

All these targets can be run separately, for instance if you only want to style the pmd results, or you can combine them in one target. For the metacheck of metacheck usually 2 targets are used, analyse and style, analyse runs all checkers and styles the results, style only styles the result.

To run metacheck for one code checker only (eg findbugs) create an ant build file with only the findbugs-style target, get the taskdef right, set the input parameters (for findbugs these are inxml and todir), and run the findbugs-style target. One can also run the findbugs target (which run clean, start and style) but then findbugs.home has to be set to your environment.

To run metacheck for a number of code checkers use the analyse.xml script as a starting point for your own script, change the analyse or style targets to your needs, set the various properties at the top of the file correct, and run it.

I'm looking for a reporting tool for FindBugs and I've found the Metacheck. Could you describe the usage of Metacheck over FindBugs in few sentences?

Creating a report for findbugs should be fairly easy, assuming you have some basic java/ant experience.

If you already have a report.xml file from findbugs you would only want the style task run for it. Look in the file analyse.xml (ant build-file) for a target named 'findbugs-style', there you'll see the syntax for the findbugs-stylist, it has 3 arguments: an output directory, an input xml-file and (optionally) the bugDescriptions.html from the findbugs distribution. If you set these arguments correct you can run it with:

ant -f analyse.xml findbugs-style.
The requested reports should appear in the output directory.

If you do not have the findbugs report.xml, the analyse.xml script can be used to do it all-in-one. Look in the file analyse.xml for a target named 'findbugs', it runs finbugs-clean, findbugs-start (run findbugs to create the report.xml) and finally the findbugs-style task. You need to set a property findbugs.home somewhere or on the commandline, and probably edit the findbugs task arguments (class location, sourcePath and auxClasspath). Then run ant with something like:

ant -f analyse.xml -D findbugs.home=/opt/findbugs-0.8.5 findbugs
or on Win32
ant -f analyse.xml -D findbugs.home=d:\opt\findbugs-0.8.5 findbugs

At the top of the analyse.xml some properties are defined to define somewhat structured the directories and filenames for the various checkers.