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

Proposal: Feature that automatically fixes issues where possible #66

Open joeapearson opened 3 years ago

joeapearson commented 3 years ago

What do you want Credo to do?

I'm certain this must have been suggested before but I can't find it. I would like an equivalent of eslint --fix that automatically fixes issues where possible.

I know one of the things that credo tries to do is behave as a teaching tool - so fixing issues for the student automatically might be considered cheating slightly! However, I think there are some good counter points to that:

Which existing behaviour would change?

I imagine this being introduced as a new CLI flag, like --fix perhaps. Credo would then output the same helpful information about each problem found, and then it would fix it automatically somehow. It'd then be up to the user to review the changes and commit if they wish.

Users already running credo would not experience a change in behaviour unless they opt in by specifying the --fix flag.

Plugin support

In researching this issue I just learnt that credo supports plug-ins. Does an existing plug-in exist? Would it be possible to implement such a behaviour as a plug-in?

rrrene commented 3 years ago

Would it be possible to implement such a behaviour as a plug-in?

Yes, but as far as I know, nobody has done so (happy to be corrected on this one).