Calculate Cyclomatic Complexity for Javascript
cyclomatic-complexity, javascript, metrics
Solution
I helped write a tool to perform software complexity analysis on JavaScript projects:
complexity-report
It reports a bunch of different complexity metrics: lines of code, number of parameters, cyclomatic complexity, cyclomatic density, Halstead complexity measures, the maintainability index, first-order density, change cost and core size.
It is released under the MIT license and built using Node.js and the Esprima JavaScript parser. It can be installed via npm, like so:
npm i -g complexity-report
Problem
Are there any tools available for calculating Cyclomatic Complexity in Javascript? I've found it a very helpful metric in the past while working on server side code, and would like to be able to use it for the client side Javascript I write.