Skip to main content
April 13, 2010
Question

Generate HTML report with ANT

  • April 13, 2010
  • 2 replies
  • 3659 views

Hello,

I'm  new to FlexPMD. I have just generated my firsts reports. I try to generate HTML reports.

I browse the documentation, this forum and the web and I find informations to :

- generate documentation with Hudson

- generate documentation with Maven

- generate documentation with XSLT pmd.xml -> html

Ok, I try to keep it simple. So I don't want to use Hudson.

I'm using ANT, and I currently don't want to install/learn Maven.

I'm using FlexUnit with ANT. And It's really simple to generate reports :

<junitreport todir="${report.flexunit.loc}">
            <fileset dir="${report.flexunit.loc}">
                <include name="TEST-*.xml" />
            </fileset>
            <report format="frames" todir="${report.flexunit.loc}/html" />
</junitreport>

I'm really new to FlexPMD, so I don't have currently a big knowledge, but it seems impossible to generate a HTML report just like junitreport. (1 line in an ANT task)

I test the XSLT transformation found on this forum (thread "XSLT pmd.xml -> html"). It's really cool. But it's seems difficult, for example, to extract the wrong code part and add it to the HTML page.

So, what is the simpler solution to generate HTML report just with FlexPMD/ANT ?

Thanks !

This topic has been closed for replies.

2 replies

Adobe Employee
April 16, 2010

Hi,

At the moment, the only solution to generate HTML reports from ANT is to use the XSL solution you mentioned.

The one line in ANT has a lot of code behind it

Feel free to create a enhancement, and maybe pick it up if you really want to.

Cheers,

Xavier

Participant
May 6, 2010

Hi,

How about use js &&  xml from ant? FlexPMD genetate xml in folder with html with js script for filtering and browse like Adobe Flex PMD Violations viewer

May 7, 2010

Hello,

Currently you generate a PMD report with ANT  like this :

<! -- define taskdef  -->

< taskdef name="pmd"  classname="com.adobe.ac.pmd.ant.FlexPmdAntTask"  classpath="${build.pmd.loc}/flex-pmd-ant-task-${flexpmd.version}.jar">
         < classpath>
             < path refid="flexpmd.base" />
             < pathelement  location="${build.pmd.loc}/commons-lang-2.4.jar" />
             < pathelement  location="${build.pmd.loc}/flex-pmd-core-${flexpmd.version}.jar" />
             < pathelement  location="${build.pmd.loc}/flex-pmd-ruleset-api-${flexpmd.version}.jar"  />
             < pathelement  location="${build.pmd.loc}/flex-pmd-ruleset-${flexpmd.version}.jar"  />
             < pathelement  location="${build.pmd.loc}/plexus-utils-1.0.2.jar" />
         < /classpath>
< /taskdef>

then generate XML  report like this :

< pmd  sourceDirectory="${src.loc}" outputDirectory="${report.loc}"  ruleSet="${build.pmd.loc}/rules.xml"/>

The  XML contains some file nodes :

< file  name="/Users/user/workspace/AS3_UTILS/src/utils/align/gridAlignSpaceNumber.as">
       < violation beginline="22" endline="22" begincolumn="0"  endcolumn="27" rule="adobe.ac.pmd.rules.naming.TooShortVariable"  ruleset="All Flex Rules" package="utils.align"  class="gridAlignSpaceNumber.as" externalInfoUrl="" priority="5">This  variable name is too short (3 characters minimum, but 1 actually).  Detects when a field, local, or parameter has a very short name<  /violation>

< /file>

The  message is in the text node  < violation>TEXT< /violation>

For  me, we miss an important part of the message : the portion of the "bad"  code.

It could be very usefull if PMD can generate  something like this :

< file  name="">
       < violation beginline="" endline="" begincolumn=""  endcolumn="" rule=""  ruleset="" package=""  class="gridAlignSpaceNumber.as" externalInfoUrl="" priority="">

        < description>TEXT< /description>

        < code><CDATA[MY CODE

MY CODE

MY CODE]>< /code>

    <  /violation>

< /file>

With this, we can  generate "full" HTML report with XSLT transform easily.

I  understand that it modify the standard XML schema of the output.

So,  perharps it could be an option like this :

< pmd fullDescription="true"  sourceDirectory="${src.loc}"  outputDirectory="${report.loc}"  ruleSet="${build.pmd.loc}/rules.xml"/>

What do you think ?

Thanks !

April 16, 2010

Hello,

Someone can help me please ?

Thanks !