-
Notifications
You must be signed in to change notification settings - Fork 31
A plea to abolish commit hooks #535
Comments
I hear you @davidmsibley. 👂 I completely agree that uPortal-app-framework should strive to be as easy to contribute to and as welcoming as possible. 💯
That is one way of looking at it.
Unit Testing, Static Analysis, and Code Style are not the gold standard for code quality 🥇 (by themselves), they are baseline metrics. They provide a low cost, low maintenance way to keep quality from dropping into a free fall 📉. While still leaving more abstract code concepts, like usability or good design, open for discussion and teachable moments. 🎓
All great points, but they are strawman arguments.
It would be helpful to know what that destination is, most of the backlog is still in a private issue tracker that the public can't access. 😉 |
Then I'll be consise. Committing is always good. There should be no barriers to committing. Your points above seem to be focused on the code. I'm not worried about the code, code can always change. I want to be able to build trust in developers. There's no amount of process and code quality metrics that will deliver a working product. |
It isn't a barrier though, it's a suggestion that is easily by passed with
I am. |
(Wrote and deleted a few long from attempts at this. Going with this:) That @davidmsibley would like to try not having the commit hooks convinces me. Let's turn them off and work together to explore how might we achieve similar advantages without actual commit hooks, probably by more attention to the PR stage of contributions. Worst case, we learn from this why commit hooks are worth it, observing when they would have helped and deciding to turn them on again in the future. Best case, we achieve similar code quality and process advantages in different ways. Doesn't annoy @davidmsibley so much, still quality, a win all around. Here's the thing: @davidmsibley and @ChristianMurphy are both talented, thoughtful committers. I predict real followthrough both on what are we learning from this, and on "how might we achieve similar advantages without relying on the commit hooks"? Code quality is a challenge, and the burden on maintainers in engaging with problematic contributions may become a more prominent challenge in the future. I don't think it's the biggest present challenge though. The biggest present challenge is attracting more contributors and more contribution. There's at least the colorable argument that commit hooks make things less convenient for contributors earlier in their contribution process and so discourage contributions before they hit the PR stage where we can engage with them. I don't have to think this hypothesis will prevail to believe that reasonable people could have this hypothesis. So let's try it. Off with the commit hooks, experiment to see whether things get worse (too much work or compromises at PR stage) or better (more contributors and contributions), and experiment with, given the constraint of not using commit hooks, what can we come up with that adds similar value. |
+0 for removing the git commit hooks. I do see value of the CI layer enforcing some rules, and with that I'll +1 the discussion about more tightly enforcing the checks. |
If githooks are being disabled, the conventional commits check will need to adapt. ref: https://marionebl.github.io/commitlint/#/guides-ci-setup?id=linting-relevant-commits |
To reiterate, I'm -0.9 on this. Meaning
All of the advantages can be achieved with out git hooks, except one.
I tested that hypothesis on one of my projects, before bringing git hooks here.
I'd be more open to moving some of the checks exclusively to CI, while leaving some hooks in place.
same |
Could we make local git hooks opt-in rather than opt-out? |
not easily. |
How about commit hooks that just run but don't block you from committing if there are errors? |
@davidmsibley Warn level git hooks would be fine. 👍 |
I'm the author of |
@davidmsibley and @apetro its also worth noting that many first time contributors use the GitHub site to make changes, git hooks have no impact on that experience. |
@davidmsibley |
UW-Madison-DoIT/widget-creator#25 offers a non-blocking approach to handling styling locally. |
So I came across a way that might make optional githooks possible. Currently husky installs itself as part of the npm install process. Its round about and a bit hacky (kinda like waiting until after code is committed and pushed to do sanity checks 😜), but it could work. edit after some more thought, a new script |
|
The last vestiges of git hooks that are on by default have been removed. |
I realize I've expressed being against commit hooks, but I don't think I've explained why.
Committing is always good. I never want to discourage people from committing. I realize there's value in influencing the quality of code, but I believe that investment should be made at the integration layer (CI and PR's). Version control should be about retaining history, so that we can learn how code came about. You can't do that if your version control stops you from storing your work until you've made it presentable.
In the same vein, I want to advocate using pull requests as learning opportunities or teachable moments, rather than customs checkpoints. No one's going to lose their job because they didn't put curlies around an if block. So, the Watchmen of this little world, we ain't. Instead, Committers get to be shepherds and explorers within the world of code. We get to learn from one another and improve our skills as we grow the value of the product. If we just enforce rules, it's difficult to learn why those rules are effective. So again, I'd encourage giving developers access to the tools that improve our codebase, and impressing upon them the reasons we value each tool.
Finally, imperfections within the code (in moderation) are often the best motivation to improve your craft. Refactoring is the most effective method of learning how and why a system works as it does. Teaching developers to spot potential problems encourages them to refactor early and often. Letting imperfect code through the integration process can drive developers to grow, while still keeping a handle on a product's technical debt.
I think the style guides and the linting have definitely given this product a lot of value, but I want to voice concern before we head too far down this path. Every project has a different set of circumstances and requirements. I'd like to make sure everyone who works on this project can navigate us towards the destination, rather than just being able to keep us on the road. I want to encourage committing early and often, using pull requests as learning opportunities, and giving developers the fire to improve. I believe this is the best way to build a community that values the same things, not one that conforms to the style du jour.
The text was updated successfully, but these errors were encountered: