actionscript-3flashapache-flexflex-pmd

FlexPMD Violations Viewer - how to view results directly


So I started using FlexPMD for static code analysis, and I want to add it to my team's build process. I have it running nicely from a shell script, and can view the results by clicking a button and uploading the desired (pmd.xml) output file in the Violations Viewer that comes with it (note there is also one online here: http://opensource.adobe.com/svn/opensource/flexpmd/bin/flex-pmd-violations-viewer.html).

But I'd like to view the results directly without having to take the extra step of clicking the upload button. I imagine there is some black magic URL parameter that works, but (if so) what is it? This site:

http://blogs.adobe.com/xagnetti/2009/09/load_pmd_results_directly_in_t.html

mentions referencing pmd.xml with a "report" URL param, like so:

http://opensource.adobe.com/svn/opensource/flexpmd/bin/flex-pmd-violations-viewer.html?report=path/to/my/pmd.xml

but it's not working for me. Has anyone encountered this problem and triumphed, by chance?

EDIT: More info... The latter (opensource.adobe.com...) webpage has the following JavaScript:

function getReport()
{
    if ( window.location.href.indexOf('=') == -1 )
    {
        return "";
    }
    var hashes = window.location.href.slice(window.location.href.indexOf('=') + 1);

    return hashes;
}

var report = getReport();

which it passes into flashvars. Perhaps the format with which I'm passing pmd.xml is incorrect?


Solution

  • Okay, figured it out. The version of the violations viewer that ships with the open source FlexPMD does not allow for automatic viewing of reports (the HTML wrapper doesn't pass in the report filepath, and the SWF doesn't take it in). The solution that worked for me was to download the files from the online violations viewer here:

    http://opensource.adobe.com/svn/opensource/flexpmd/bin/flex-pmd-violations-viewer.html?report=path/to/my/pmd.xml

    by using your browser to just save the webpage, and then curl to save the SWF file (directly trying to save from the browser will not work - appears to redirect to a null address) to like so:

    curl -O http://opensource.adobe.com/svn/opensource/flexpmd/bin/flex-pmd-violations-viewer-1.1.swf

    and place in the same directory as the violations viewer html file you downloaded. Then you can read your reports automatically! Here is an example (absolute filepath on Mac):

    file:///path/to/your/violations-viewer/ViolationsViewer.html?report=/Users/joverton/some/project/path/bin-debug/pmd_reports/pmd.xml