Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#300 Add Category attribute in the xml file


We would like to build metrics report of our code.
But the result of thoses metrics must be for the
So I have to produce somes nice graphs.

They graphs will contains classic metrics, but also
somes sanity checks metrics.

For sanity checks metrics, we will use Checkstyle. And
would like to produce metrics for each category.

The problem is that, in the generated xml file, for
each error, I have the severity, the source, but not
the category it belongs.

It would be nice if I could have also the category
appearing as attribute of the error:
* Javadoc Comments
* Naming Conventions
* Headers
* Imports
* Size Violations
* Whitespace
* Modifiers
* Blocks
* Coding Problems
* Class Design
* Duplicate Code
* Metrics Checks
* Miscellaneous Checks
* Optional Checks

Could you consider to add those informations in the xml
file ?
And/Or maybe also provide a way to create his own

Or if someones of you already did the same, could you
please share with me ?

Thanks a lot


  • Rick Giles
    Rick Giles

    Logged In: YES

    The categories above are implicit in the full package name
    of the source attribute value for an error element. Can you
    accomplish what you want with XSLT instruction <xsl:choose>
    and function starts-with()?

  • Logged In: YES

    I would like this functionality in the errors as well. Using
    the package name sound rather like a quick fix.

    I would also like to include the category in the module
    definition in the checkstyle configuration, as this would be
    VERY beneficial for generating a coding standards document
    from the checkstyle configuration.

  • Lars Kühne
    Lars Kühne

    Logged In: YES

    Martijn, to store additional data in your checkstyle config
    file you can use the "metadata" as a subelement of each
    module. Unfortunately metadata is not currently documented :-(

    Example for you usecase (note you are free to choose your
    own categories):

    <module name="NeedBraces">

    The Checkstyle configuration parser will ignore metadata (it
    was originally meant to be used by IDE plugin authors).