germsvel

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 30 follows 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

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

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

mudasobwa

Creator of Cure

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.

Where Next?

Popular in Announcing Top

tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
bryanjos
Hi, I just published version 0.23.0 of Elixirscript. https://github.com/bryanjos/elixirscript/blob/master/CHANGELOG.md Most of the chan...
New
zorbash
I created Kitto a framework for dashboards inspired by Dashing. The distributed characteristics of Elixir and the low memory footprint...
New
kip
ex_cldr provides localisation and internationalisation support based upon the data from the Unicode CLDR project. Unicode released CLDR ...
407 13056 120
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
michalmuskala
Another small library today. PersistentEts Hex: persistent_ets | Hex GitHub: GitHub - michalmuskala/persistent_ets · GitHub Ets table ...
New
achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
dbern
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31194 112
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31307 143
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54250 245
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement