4 Replies Latest reply on May 7, 2010 3:36 AM by ehrwerhqergsehn

    Generate HTML report with ANT




      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" />
                  <report format="frames" todir="${report.flexunit.loc}/html" />


      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 !

        • 1. Re: Generate HTML report with ANT
          ehrwerhqergsehn Level 1



          Someone can help me please ?



          Thanks !

          • 2. Re: Generate HTML report with ANT
            Xavier Agnetti Adobe Employee



            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.





            • 3. Re: Generate HTML report with ANT



              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

              • 4. Re: Generate HTML report with ANT
                ehrwerhqergsehn Level 1



                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 !