Wednesday, April 17, 2013

Plato: a JavaScript source code visualization, static analysis, and complexity tool

To improve the quality of my JavaScript code, I’m always looking at good tools (like JsLint) that can help me writer better code and more maintainable code.

Last week I discovered Plato,a JavaScript source code visualization, static analysis, and complexity tool.

This node.js module analyses your JavaScript code and gives you an indication about:

  • The maintainability of your code
  • Lines of code
  • Estimated errors in implementation(based on the Halstead complexity measures)
  • Lint errors(based on the results of JsHint)

Get started

  • Download and install node.js from the node.js website(http://nodejs.org/download/)
  • Start a command prompt
  • Install plato as a global module through the npm package manager: npm install -g plato

image

  • Browse to the folder where you want to run Plato.
  • Call Plato and specify to do a recursive scan on the scripts folder:  plato -r -d reports scripts
  • Go to the reports folder and open the index.html page to see the results(here you see an example run on Marionette.js):

image

No comments: