如何计算Clojure函数的圈复杂度? [英] How to calculate cyclomatic complexity of a Clojure function?

查看:99
本文介绍了如何计算Clojure函数的圈复杂度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

计算Clojure函数的圈复杂度的合理方法是什么?根据 if和 cond之类的函数来计算决策点很容易,但是使用宏开始变得棘手。有人尝试过使用Clojure或其他功能语言吗?

What would be a reasonable way to calculate the cyclomatic complexity of a Clojure function? It's easy to count decision points based on functions like 'if' and 'cond', but it starts to get tricky with macros. Anyone has tried this for Clojure or maybe another functional language?

推荐答案

宏是一种抽象,不应该用于CC计算,

Macros are an abstraction and should not contributed to the CC calculation, any more than a function call would.

话虽如此,我认为CC对Clojure并不是特别有趣。我对测量过度使用可变性的东西更感兴趣。

That said, I don't think that CC is particularly interesting for Clojure. I would be more interested in something that measured overuse of mutability.

这篇关于如何计算Clojure函数的圈复杂度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆