Hacker News new | ask | show | jobs
by ShaneWilton 3584 days ago
It determines this by computing the cyclomatic complexity of the function. You can think of the cyclomatic complexity as being the number of distinct paths through a function.

The rich support for quoting / unquoting code in Elixir makes it possible to easily compute metrics like this. The implementation in Credo essentially walks through the code, keeping track of how many "branch" operations are encountered.

https://github.com/rrrene/credo/blob/master/lib/credo/check/...