-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Setup git precommit hooks for lint issues #214
Comments
The issue I see with git pre-commit hooks is that they aren't configured automatically when a repo is cloned, meaning that we will be relying on contributors installing the hooks, which unfortunately in my opinion is a big weakness to the pre-commit hook solution. However, I cannot come up with another better solution off the top of my head so it is better than nothing. This stack overflow post that is seeking a solution to the issue I stated above. I like the solution put forward by the user Max Shenfield that would allow us to have git tracked hooks, which we could then facilitate the installation of with a small setup script. Something else that could facilitate contributors following the conventional commit convention would be to include a commitizen config. That's the tool I personally use, but if there is a more widespread one I'm all ears. I can open a quick PR adding a .cz.json config file if this is deemed a suitable solution. |
I haven't used |
Also, this might be a little out of scope for this issue, but regarding the issue of enforcing conventional commit, can we prevent the squash and merge if the resulting commit name doesn't conform to the conventional commit spec ? I'll throw together a PR real quick for Edit: Might not be able to do it today, but in the upcoming days 👍 |
add customized commitizen config to match repo needs implement request mentioned in [ratatui#214](ratatui#214) by @joshka
Now that we have a |
Could we perhaps use https://github.com/crate-ci/committed and either https://crates.io/crates/rusty-hook or https://crates.io/crates/cargo-husky instead
This issue was put in place mainly because I wasn't sure what the right rust answer for this was. There might be other solutions out there and I was hoping someone more informed would come along and tell us. |
While both |
I've started working on it. Is it preferable for the hook to install |
I'd just print a suggestion to install it in the case it's not already installed, but do as you see best fit and we'll get more opinions when you open up a PR ! I'll assign you to the issue since your working on this :) |
How are you going about it in the end ? |
add cargo-husky to dev-deps, create hook, update `CONTRIBUTING.md` ratatui#214
Fixes ratatui#214 - add cargo-husky to dev-deps - create hook - update `CONTRIBUTING.md` - ensure that the hook is not installed in CI
Fixes #214 - add cargo-husky to dev-deps - create hook - update `CONTRIBUTING.md` - ensure that the hook is not installed in CI
I think this can be closed since #274 was merged. |
Problem
We often see action check failures due to conventional commits, cargo clippy lints, and rust format.
Solution
There's a bunch of ways to have pre-commit git hooks that check rust format, clippy, and conventional commits. Evaluate the options and choose the appropriate one to implement. I'm not sure which one is the best / most used / idiomatic.
Alternatives
None
Additional context
Installation of any required tooling should be low impact. Bonus points for borrowing the config of some reasonably stable project.
The text was updated successfully, but these errors were encountered: