Open nelsonic opened 7 years ago
Hoping someone else has discovered an elegant way of doing this in without resorting to node.js ... https://github.com/dwyl/learn-pre-commit/issues/6#issuecomment-328643295
How about this one https://github.com/dwyl/elixir-pre-commit @nelsonic?
Currently in the process of adding it although encountering an error with mix credo
that I'm having to look into.
@Cleop yeah, I just wanted help from someone to implement it. 😉
Came across these re broken credo on the credo repo: https://github.com/rrrene/credo/issues/463 https://github.com/rrrene/credo/issues/496
Changing the credo line as the second comment suggests got it running successfully on mix credo
but failing when I try to do a commit
Pass:
Fail with no further explanation:
More on the same here: https://github.com/rrrene/credo/issues/469
Maybe I'm best off adding my feedback to the credo repo too, despite the fact it's supposedly been fixed there... looks like some other people are still experiencing the problem:
@nelsonic @SimonLab - what do you think? Just want to make sure I've not overlooked anything?
I've asked directly on the credo repo here on an update/ advice: https://github.com/rrrene/credo/issues/495#issuecomment-366679851
Response from @rrene shared these links:
https://git-scm.com/docs/githooks pre-commit [...] Exiting with a non-zero status from this script causes the git commit command to abort before creating a commit.
Credo fails with an exit status != 0 if it shows any issues. This enables shell based pipeline workflows (e.g. on CI systems) which test Credo compliance.
These are the scores of exit statuses that credo emits based on any shortcomings in your code:
Therefore the reason the pre-commit is failing is because we're not exiting with an exit status of 0 because of the amendments that could be made to the code.
So to solve this issue we need to resolve the credo suggestions to give an exit status of 0.
as a developer I don't want to have to remember to run the linter (dogma) each time I commit my code ... I want it to run automatically! see: https://github.com/dwyl/learn-pre-commit
e.g: https://travis-ci.org/dwyl/hits-elixir/builds/274319451#L689 where the tests pass but the "dogma" code style fails...! 🙄