(Should copy more lints from https://github.com/Manishearth/rust-clippy though! ;))
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/...
"Automated Elixir code review with Github, Credo and Travis CI" https://medium.com/@fazibear/automated-elixir-code-review-wi...
For those venturing into Elixir, Credo is especially useful. While I'm experienced in functional programming, Credo was a great way to learn more idiomatic usage of Elixir.
While Haskell has the fantastic ghc-mod for guided refactoring, Go has gofmt, and Ruby has rubocop among others, I find Credo to be a nice blend of the best features of all these tools. I also appreciate the UI, which groups feedback into 3 visually-distinct categories: Code Readability, Refactoring Opportunities, and Warnings [1]. This makes it makes it easy to prioritize your changes.
If you'd like more background on Credo, The Elixir Fountain [2] recently hosted a nice podcast with the creator of Credo, René Föhring [3].
[1] http://credo-ci.org/ [2] http://elixirfountain.com/ [3] https://soundcloud.com/elixirfountain/elixir-fountain-rene-f...