-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to setup a pre-commit hook for Elixir / Phoenix projects #6
Comments
this would be π Did a little poking around, and this looks promising: https://mattvonrocketstein.github.io/heredoc/elixir-boilerplate.html it uses this: http://pre-commit.com/ |
So i've got it working here π - but theres a difference from what we've been used to with the This kind of makes sense as it should be running the tests on the code you're committing not all the changes you've made but as a side effect to stashing your unstaged changes, it creates a Its better than nothing for now so will leave it in until we find a better solution |
Is there a reason not to use https://www.npmjs.com/package/pre-commit in our Phoenix projects? Do we plan to move away from needing to include node altogether? |
@Danwhy good question. please elaborate. |
Yeah, just installing it with npm and running as we would on a Node project, but with I've just tried it, and it seems to work fine. We just add our Phoenix test script as the |
@Danwhy you sir, are a genius!! π¦ |
Using https://www.npmjs.com/package/pre-commit is a great solution for Phoenix projects, but for the Elixir Libraries which we build without Phoenix, we won't have node and this solution doesn't really feel right. |
@Shouston3 yeah, for Elixir-only (Non Phoenix) projects we do need an Elixir-specific solution ... |
@Shouston3 did you discover how to add the pre-commit hook in Elixir projects without |
No, I never looked into it, as we were happy with the solution @Danwhy suggested. But, with Phoenix 1.3 changing it's folder structure so that node doesn't pollute the root, the solution may no longer suffice and an elixir pre-commit may be a much better solution. Do you think it would be good to harness what has already been built in node (or something else), or look at building it entirely in elixir? |
@Shouston3 good question ... good point on the Phoenix 1.3 re-org! However how many people writing code in 2017 don't have Node.js installed on their The thing I want to avoid is falling into the temptation of using node to run the tests on CI ... https://travis-ci.org/dwyl/tudo is running the CI tests without touching the I'm going to |
Haven't looked at it in depth yet, but this may be worth checking out: https://hex.pm/packages/pre_commit_hook |
The one I linked above isn't configurable, so @finnhodgkin and I made a hex module for configurable pre-commit in elixir! Let us know any thoughts and please try it out! https://github.com/dwyl/elixir-pre-commit |
we all know how to setup a pre-commit hook for our Node.js projects ... β
but how is it done for
elixir-lang
/phoenix
projects...? π€The text was updated successfully, but these errors were encountered: