mau013

mau013

Hi everyone,

I have just added Credo to my project and I really liked it. I would like to take it a step further and implement further checks via plugins but I’m struggling to find a list of them… so my questions for you all are:

  1. Which Credo plugins are you using (if any)?
  2. Is the community gravitating towards a common set of checks other than those included in Credo itself?

Thanks a ton for any help.

Showing Posts 1 to 10

sodapopcan

sodapopcan

Adobe has some. I know there are others but none off the top of my head.

There are definitely a lot of style plugins that are up to personal taste and I think should stay that way, so I’d suggest looking through the disabled ones that come with Credo as there are some good ones! I particularly like the one that forces you to always pass the :async option to use ExUnit.Case. This way you can be relatively sure that whoever set it did so for a reason and didn’t absent-mindedly choose the default.

pdgonzalez872

pdgonzalez872

Default, not even having a credo file.

Just having something in place gets you 80% there, if not more. You get diminishing returns as you add more, the value it provides starts decreasing after a while, especially in big teams. Checks that are disabled/added because someone that left 3 years ago didn’t quite like it/or thought it was amazing at the time will haunt you later on.

IMO, your miles may vary.

mau013

mau013 OP

Thanks! I’ll check this out.

Will do. I’ll take a close look at the disabled list and make sure I’m not missing some I find useful :smiley:

Yeah, I guess I’m at the point where defining a style for the project is still quite easy, so I’m trying to see where to strike the balance… if there were some clear preferences across the community I would probably swing that way - if only for the sake of making the code more readable / standard… but to your point perhaps the default credo checks already gets us there :wink:

pdgonzalez872

pdgonzalez872

if there were some clear preferences across the community I would probably swing that way

This is precisely it, and I believe the default checks are the answer here. Since Credo is open source and there are TONS more eyes on those default checks, I favor that decision over any in house discussion/decision.

D4no0

D4no0

This results in the same conclusion as the elixir formater arrived to:

The consistency over every random project you can open on the internet makes them more readable and easier to understand, simply because everyone formats/writes code in a similar style.

cmo

cmo

Disable the cyclomatic complexity one so you can write big boy/girl functions :grin:

sodapopcan

sodapopcan

Consistency, even within private projects, is the number one reason I care to use Credo, though the code suggestions are nice too since I don’t use any AI tools.

Big teams, period, is where the deminishing returns are :wink: If people are spending long periods of time arguing over what should go in Credo, or people are adding stuff without telling anyone, there are bigger problems at play. All that to say is that I generally agree the default is ideal, but for me the defaults are a little much and are just there to guard against juniors. Like:

Also stuff like “alias all the things” and “no single pipes” are things that are context-dependent AFAIC. Useful if you’re just letting anyone loose on your codebase, not for my own things.

katafrakt

katafrakt

I remember we have one custom to check if the migration version is a correct timestamp and if it’s not far in the future. The story behind it is that we had some people that liked to touch migration files by hand, without the generator, and at some point we have a migration with timestamp from the future, so every time you wanted to rollback your newly created migration, it rolled back that one instead.

Apart from that I sometimes advocate to have a check forbidding “full imports”. I used it as an example in this article. The check is not perfect IIRC, but bypassing it takes some dedication.

We also use checks from excellent_migrations, but lately I see many people disable them immediately in their migrations, so I guess we have to reevaluate.

dimitarvp

dimitarvp

I dislike the raw SQL check myself but the rest I actually like. IMO just discuss with the team. I always recommend the maximum amount of checks and then we just disable whatever ends up being annoying or giving too many false positives.

warmwaffles

warmwaffles

So for our code base we have a few situations where async is not possible (modification of application config) and we have the setup block raise. In other cases I have been debating just emitting a warning to annoy devs to make them async. In some cases, it just is not possible to make async. But overall, most can be.

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews