Skip to content
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

Pre commit #1763

Merged
merged 4 commits into from
Sep 5, 2023
Merged

Pre commit #1763

merged 4 commits into from
Sep 5, 2023

Conversation

mbway
Copy link
Contributor

@mbway mbway commented Sep 3, 2023

maturin has various checks that run on the CI so it would be helpful for contributors if they could easily run the same checks locally so they can find out if there is a problem before their code reaches the CI.

pre-commit is a tool used by many projects to run checks before every commit (and can also be run manually with pre-commit run --all)

@netlify
Copy link

netlify bot commented Sep 3, 2023

Deploy Preview for maturin-guide ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6c78521
🔍 Latest deploy log https://app.netlify.com/sites/maturin-guide/deploys/64f62bd747cdc000083e22c5
😎 Deploy Preview https://deploy-preview-1763--maturin-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

language: system
pass_filenames: false
# rustup component add clippy
- id: cargo-clippy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should add cargo check and cargo clippy in pre-commit hooks because they may take a long time which makes the git commit UX bad.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to set these checks to run only for the 'manual' stage which means only when pre-commit is run with pre-commit run --hook-stage manual --all.
It's debatable whether another task runner like makefile, cargo make or just would be easier to use for this, but at least pre-commit is able to serve as a commit hook and also as a way to fairly easily run all the checks at once with a single tool.

Copy link
Member

@messense messense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@messense messense merged commit 664144a into PyO3:main Sep 5, 2023
31 checks passed
@messense
Copy link
Member

messense commented Sep 5, 2023

FYI, I've also set up pre-commit.ci for this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants