Plato is a code npm module which is used to generate HTML report on Javascript code analysis.

Install Plato

Same as Istanbul Plato is running over node, therefore the first step is to install node http://nodejs.org/

Once node is configured, install Instabull by running the command:

$ npm install plato

How to generate HTML report with Plato

The code analysis report should be generated any time the build action of Jenkins is triggered. Run Plato any time after the workspace has been synced with the Repositories and before the build process is terminated. To run Plato during the build process Is necessary to modify the build.xml ANT file and add an extra task to execute Plato. 

To run Plato launch the command

$ plato -r -d <output_dir> <input_dir>

The paramether -r is used to expand the input directory tree to search for the JS files.

Customize Jenkins build process

The Jenkins customization to Integrating Plato are similar to the configuration to integrate Jenkins with istanbul.
In this page the step are described in short bullets; please refer to the Jenkins Integration with Istanbul for a detailed documentation.

 

The  properties workspace.plato.input.dir and workspace.plato.output.dir are custom properties used to specify the input directory and the output directory for plato. Those directories are not absolute but are relative to the servoy workspace directory. For example if the workspace directory is set to WORKSPACE=C:/user/workspace and the Plato input directory is set to workspace.plato.input.dir=svyUtils then Plato will use as input directory C:/user/workspace/svyUtils

Setup the HTML Publisher Plugin to display the report

Install the Jenkins plugin https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin.
Once the plugin is installed create the Post-build action in Jenkins 
Publish HTML reports. Specify the relative path from the Jenkins workspace to the index.html page created by plato. The index.html has been created by Plato in the relative directory specified in the property workspace.plato.output.dir. The index.html page will be then accessible from Jenkins.