计算Java语言的循环复杂度 [英] Calculate Cyclomatic Complexity for Javascript
问题描述
有没有可用的工具来计算Java语言中的循环复杂度?
Are there any tools available for calculating Cyclomatic Complexity in Javascript?
过去,在处理服务器端代码时,我发现它是一个非常有用的指标,并且希望能够将其用于我编写的客户端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.
推荐答案
我帮助编写了一个工具,可以对JavaScript项目执行软件复杂性分析:
I helped write a tool to perform software complexity analysis on JavaScript projects:
它报告了许多不同的复杂性指标:代码行,参数数量,圈复杂度,圈密度,霍尔斯特德复杂性度量,可维护性指标,一阶密度,变更成本和核心大小.
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.
它是根据MIT许可发布的,并使用Node.js和 Esprima JavaScript解析器进行构建.可以通过npm安装它,如下所示:
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
这篇关于计算Java语言的循环复杂度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!