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
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: GitHub - tmbb/phoenix_ws: Websockets implemented over Phoenix Ch...
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New
woutdp
Hi! I wanted to introduce my latest project LiveSvelte. It allows you to render Svelte inside LiveView with end-to-end reactivity. It’s ...
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
mindok
What is ContEx? A pure Elixir server-side data plotting/charting library outputting SVG. It has nice barcharts in particular and works g...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
198 10978 107
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43657 311
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement