rrrene / credo-proposals

Proposals for Credo, the Elixir code analysis tool with a focus on code consistency and teaching
MIT License
9 stars 0 forks source link

Add Igniter? #102

Open kevinschweikert opened 3 months ago

kevinschweikert commented 3 months ago

Hey, I just read this article about the new igniter tool and Credo was mentioned to benefit from it. How do you think about this? Would you accept a PR to add igniter to this project?

rrrene commented 3 months ago

Hi, I moved this issue to the right repo. Please read the issue template when creating an issue instead of deleting it.

Regarding your question: I will probably not, as I cannot read your mind with regards to what a PR would contain specifically 🤷‍♂️

edit: To clarify: I might very well be interested in your idea for a feature, of course. That is a big part of open source. But so far, you just mentioned some tech you want to use.

kevinschweikert commented 3 months ago

Totally! And I definitely should have read the template, even in my excitement for a good idea! Thanks for transferring it to the right place.

To cite the Igniter docs

Igniter is a code generation and project patching framework.

For library authors, this is a tool kit for writing smarter generators that can semantically modify existing files, and all sorts of useful tools for doing so.

and the part of the article I was referring

When working users initially set up credo , they will typically run mix credo.gen.config to generate a configuration file. This configuration file contains all of the checks that credo knows about when the config was generated. What this means is that when new Credo checks are created added by its maintainers, there is no reasonable way to automatically include them in your config file without monitoring how the project is changed, what the new modules are, etc.

This is basically already it. In the past, I went through the CHANGELOG and was manually checking if there were some new or updated credo checks available. I liked the proposed idea of the article and felt motivated to try it if you would be interested in this integration.

I haven't worked with Igniter so i don't know exactly what needs to be done. But from the docs it seems that you just need to write a custom mix task.

rrrene commented 3 months ago

This is probably at the center of the proposal, to have a way to tell if there are new checks available. I think that this could be a great feature! 💯

I am not super happy with the idea of adding all the transitive deps that igniter would bring, as it would roughly double Credo's total dependency count.

We could probably work something out that covers the core use-case in a leaner way without adding so much potential debt, especially since I think that we haven't specified what the command (we are talking about a command, right?) would be doing (it seems you want to edit some files automatically, but what does that mean, specifically?).