Static JavaScript code Analysis
As JavaScript might be the world’s most misunderstood language, but it is one of most popular and used one. Then you need to deal this in more nice way, better structure of code, unit and automated tests etc. So the available tools helps you manage your code in more managed way.
You can’t control what you can’t measure Tom DeMarco
This quote inspired me while i was studying. Now i found this helpful in my career. But this is not easy, you need to collect data, visualise it, do some analysis and take some good decisions.
Plato gives you static JavaScript analysis and reporting for free.
Create an app with angular-fullstack. Refer to post Modern development stacks: Boilerplate
Install it in the folder which code you want to visualise. For example we take angular-fullstack app.
npm install plato
And then execute
node_modules/.bin/plato -r -d server-report -t 'Server' -x .json ./server
As a result you’ll get an amazing report with dozens of different visualizations of your data, generated directly into your specified output folder server-report
. Here are some screen shots.
Conclusion
Try this and see if this make sense for you. Developer’s job is not only meet customer’s requirement, but also needs to write the code which is maintainable and extendable.
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.
You can use this as part of your continuous integration cycle, run this analysis on each commit and push the report somewhere on webserver, so that all developers can see and improve the code.