Static code analysis for free
Plato gives you static code analysis for free. Now it’s your turn to use the data to your advantage
2 min read
2 min read
You can’t control what you can’t measure Tom DeMarco
A quote that remained me from my university studies. But it’s damn hard, isn’t it? You need to collect data, process and prepare it, in the best case visualize it in some way s.t. you can then analyze and draw conclusions from it.
$ npm install plato
and then executing it on your codebase.
$ node_modules/.bin/plato -r -d plato-report -t "My report title" -x .json ./src
As a result you’ll get an amazing report with dozens of different visualizations of your data, generated directly into your specified output folder
plato-report. Below is an example screenshot from the official Plato website of the result of running it on the jQuery codebase.
Give it a try and see whether it makes sense for you. The job of a good developer is not only to implement the feature the customer requested, but to implement it in the best of his knowledge. As part of my daily job I have to care about the design of the application, about the “beauty of the codebase” as I like it to define.
Plato makes it extremely easy to generate a report, so the real challenge is to interpret the results, identify potential weaknesses and sanitize them accordingly.
So what I did is to create a Jenkins job which generates and publishes the reports on a webserver where all of our devs have access to. Takes you a couple of minutes but it’s extremely useful.