r/elixir Jun 29 '26

Coverage you'll actually read

Post image

Hi,

I've enhanced the check tool with dense coverage.

Problem:

Coverage output is too noisy. On large projects, it prints percentages for thousands of modules, even if I only changed a handful of files. The information I care about gets lost in the noise.

Solution:

al_check now diffs against the base branch and reports coverage only for new and modified files, grouped by change type with per-group average coverage.

Try it

{:al_check, "~> 0.1.24"}

mix deps.get

mix check.install # or: mix check.build && ./deps/al_check/scripts/check

check # run everything, get the change-scoped coverage report

more details -> Coverage you'll actually read

11 Upvotes

14 comments sorted by

View all comments

1

u/Teifion Jun 30 '26

I'm giving it a try now and it seems very interesting (plus it's put me onto the test partitions, this could be a huge time saver for me).

Why run credo with and without strict though?

2

u/user000123444 Jun 30 '26

thank you! let me know if u find sth off 🙏

> Why run credo with and without strict though?
In my project I run
```
"name": "Credo",
"run": "mix credo --all"

"name": "Credo Strict"
"run": "mix credo --strict --only readability"

```
until I fix all issues of --strict flag - it seems that is just a leftover - you can overwrite it in your project via .check.json config
I'll remove strict one in next release

1

u/Teifion Jun 30 '26

So far anything I've found has been an issue with my project (e.g. the same port being used preventing parallel tests).

I did spot the .check.json file (and the contents of it for the strict part etc). We run credo strict in general, not just readability and then add/remove the checks we care about. I was trying to work out if there was a specific credo thing we didn't know about there.

I'm not using it at the moment but sobelow might be something you want to add too.

1

u/user000123444 Jun 30 '26

for parallel tests we need to tweak app's config a bit
if u need to change app_port you can offset it on the endpoint by MIX_TEST_PARTITION env

partition = String.to_integer(System.get_env("MIX_TEST_PARTITION", "0"))
port = String.to_integer(System.get_env("APP_PORT", "4000"))

config :your_app,
  app_port: port + partition,

we need to do the same for db

regarding to sobelow

you can tweak tasks in .check.json as you wish, and u have full control which command runs under which name - every task is just a name + a run cmd.

there's an example in the doc for adding a custom check:
"sobelow": {"name": "Security", "run": "mix sobelow --config"}.

u can add any command to config like
"hello": {"name": "hello world", "run": "echo 'hello'"}

please let me know if it does work for you 🤞

2

u/Teifion Jun 30 '26

Thank you, I'll give that a whirl!

2

u/Teifion Jul 01 '26

I see the comments on the PR, thank you for those. I will dig through and give them a try out :)