-
Notifications
You must be signed in to change notification settings - Fork 12
chore: add pre-commit CI #90
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
base: main
Are you sure you want to change the base?
Conversation
|
This feels too magic for me. So, the commit I push is NOT the commit that shows up on the PR? |
|
not exactly - take a look at
As you can see - whenever a user submits a PR, if they forgot to This greatly improves the process for the casual contributors. Otherwise, if a user forgets to format, the contributor has to wait until CI completes, reports a simple annoying error, than the user has to re-submit (while swearing quietly), and only then get the "real" CI feedback. Very often projects do not even run CI for new contributors - which means the contribution is not even reviewed right away, and only when approved to run, the feedback is generated. So to avoid all these papercuts, precommit just fixes the simple things. And as I mentioned - MapLibre (a very large project), and numerous other projects have had massive success with this - attracting casual and long term contributors. |
|
P.S. this is very similar to the common process of the project maintainer fixing some simple things in a user's PR |
|
P.P.S. This pattern is actually massively popular now - GitHub search returns 153,000 cases (and that's excluding forks!) |
|
I personally hate formatting-only commit, they litter the commit history with needless noise. |
|
@khaledhosny 100% agree - that's why all my projects require squash merge -- in the main settings page:
|
|
notice that most contributors keep adding to the PR additional commits - and only when things get merged, they get quashed into a single entry in the main history |
Once enabled, pre-commit CI will keep all PRs clean by automatically doing `cargo fmt` and other minor linting, without requiring users to re-submit their changes. Note that this is done by CI on the server, and not by user's own git hook. # Maintainer TODO sign-in into https://pre-commit.ci/ and enable this repo for automatic PR validation (we had tons of success with this at MapLibre, and many other projects)
for more information, see https://pre-commit.ci


DO NOT MERGE until #163 is merged
Once enabled, pre-commit CI will keep all PRs clean by automatically doing
cargo fmtand other minor linting, without requiring users to re-submit their changes. Note that this is done by CI on the server, and not by user's own git hook.Note that this used to be part of #83