germsvel
ExCrap - a library to calculate Change Risk Anti-Patterns (CRAP scores)
I recently published ExCrap, a library (primarily a mix task) for calculating Change Risk Anti-Patterns scores (or CRAP scores).
What are CRAP scores?
From the README:
CRAP combines function-level cyclomatic complexity with function-level coverage to highlight code that is risky to change because it is both complex and under-tested. The default threshold of
30follows the historical CRAP convention.
It’s a measure that combines test coverage and cyclomatic complexity to try to measure how “risky” any given function is.
The usage is simple. It’s used as a mix task:
mix crap
mix crap --verbose
mix crap --max-cover 10
NOTE:
I created the library without looking at the code (though I checked the code before publishing it) as a personal experiment in verification. I use the library in my projects. But I mention that because some people might have reservations about using it knowing that I didn’t manually write the code myself. So, just want to be clear about it.
I also wrote a blog post on why I created it that way.
Links
Most Liked
benwilson512
I think this is a cool metric but I just have to laugh at the juxtaposition of the name and the “I created this without looking at it” remark. Truly we live in fascinating times.
mudasobwa
I like it and I want to use it in my projects, if it were a custom credo check rather than another tool I have to plug into pipelines and not forgetting to run locally.
AFAICT, the whole idea is perfectly fitting the custom credo checks. Being an author or oeditus_credo I would kindly ask you if you are open to either contribute to it directly, or to let me steal the code to become a part of this supplemental credo checks lib.
Sidenote: muex suffered a whole lot of improvements this weekend, so you’d probably want to try the newest version. THe noise should be drastically decreased.
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









