ca1989
Hi all,
as per title, I am considering the possibility to add git hooks to a Phoenix project.
We are a team af a few people (< 10) with the same editor setup.
No CI workflow is present at the moment.
That is why I would like to add git hooks, do you have advices on which checks to run and when?
I would love for them to don’t get much in the way (for example, when prototyping features on temporary branches).
I thought about this:
mix clean && mix compileon pushmix formaton commit (is that a good idea to format files in place on commit? Running--check-formattedcould be too annoying)mix credoandmix testas responsibilities of developers
I’d love to hear from you
Kind Regards
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
Start with solving that.
IMHO commit hook should not modify code.
crova
You might want to look at ex_check | Hex.
You could put that on your hook.
al2o3cr
I’m curious about the motivation of this step; why would somebody be committing code that doesn’t compile? If it doesn’t compile, it can’t run in tests or even with manual prodding.
szsoppa
Hey! There is a cool lib for that - helps maintain the proper “local CI” (Git hooks) for all of the devs in the project: GitHub - qgadrian/elixir_git_hooks: 🪝 Add git hooks to Elixir projects · GitHub.
benwilson512
FYI this will be a real pain the first time somebody on your team needs to push up code that won’t compile so that a team member can help them.
I agree with @hauleth, this is the problem to solve. You can put specific rules about specific branches, rules about how PRs get merged etc, and it lets you handle
mix credoandmix testcentrally too.ca1989
In our setup you have to run tests manually. If you forget to run them you could very much commit code that doesn’t compile
Which is the reason I thought about git hooks
ca1989
Thank you all,
setting up a CI seems the most logical first step to make.
eahanson
I have a shell script in every project I work on called
bin/dev/shipit.It does all the things such as:
If all those things pass, then it pushes. It’s very simple but it works (if everyone remembers to run it instead of just
git push). If you for some reason need to push with one or more of those steps failing, you can just not run the script but instead just rungit push.tfwright
I am strongly against imposing workflows on developers collaborating on a project. Everybody has a different order/process for producing code that is ready for review, and until its ready for review (and CI) all barriers and challenges should be minimized. If part of your process is to autoformat your code on every commit using a git hook, by all means do that, but please, please don’t impose that on your fellow devs who do not want to think about formatting at all until everything is ready.
gregvaughn
I like writing a custom
mix citask/alias. The CI server should be configured to execute that, but also each developer can choose to run that on their own machine in case they need help diagnosing a problem that only occurs on CI.