Last Updated: February 25, 2016
·
6.876K
· calamari

Reduce Code Complexity for JavaScript using Plato

Developers love writing code. But most developers don't like maintaining code. Writing code that is well structured, follows some guidelines and is less complex helps maintaining it, and also helps finding and avoiding bugs.

A nice way to find the parts of the code that may not be that maintainable is using static code analysis. Try using [Plato][plato] to get a nice overview of the state of your JavaScript codebase.

What does it show?

It shows a nice formatted and visualized summary of the state of your code counting the lines of code you wrote, calculating branching complexity measures, a score for the difficulty of the code and a score for the maintainability using the [Halstead Complexity Measures][halstead].

How to use it?

Install it:

npm install -g plato

Create the report:

plato -r -d complexity src

Watch the report:

open complexity/index.html

And now go try make your code better!

[plato]: https://github.com/jsoverson/plato
[halstead]: http://en.wikipedia.org/wiki/Halstead_complexity_measures