我是CRAP指标的粉丝,并使用它来监控我的C#和Java项目的代码质量。
我想为我不断增长的Javascript代码库做同样的事情。
有没有一个现有的流程可以轻松地将其集成到我的Javascript构建流程中?
发布于 2011-01-01 11:51:41
这个糟糕的公式是:
var complexity = ...; //cyclomatic complexity of a method
var coverage = ...; //test code coverage for the method
var crap = Math.pow(complexity,2) * Math.pow(1 – coverage/100,3) + complexity;
因此,您需要calculate the cyclomatic complexity和calculate the test code coverage (或here)。
发布于 2012-11-24 19:56:48
jshint计算圈复杂度,参见http://www.jshint.com/docs/参数maxcomplexity。我不知道如何检索结果,但您可以查看jshint源代码。希望这能有所帮助
https://stackoverflow.com/questions/4408590
复制相似问题