coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.36k stars 1.25k forks source link

git: Add git hooks #1086

Open paul-schaaf opened 2 years ago

paul-schaaf commented 2 years ago

ci will fail if cargo fmt -- --check or cargo clippy --all-targets -- -D warnings fail. this can be prevented locally with git hooks that abort commit if these checks fail

armaniferrante commented 2 years ago

Maybe we shouldn't use clippy in a hook, if that implies clippy is run for every commit? That can take a while and might be annoying.

paul-schaaf commented 2 years ago

right that is annoying. ok just fmt then, could also add lint for ts and add lint checks to the ci

fanatid commented 2 years ago

I'm ok with hook for every commit if I can disable it :laughing:

tomlinton commented 2 years ago

Clippy might be OK as a pre-push hook rather than a pre-commit hook and then git push --no-verify if you want to skip. I think it's roughly equally painful waiting for the pre-push hook as it is waiting for the CI failure because you didn't run it 🤣

paul-schaaf commented 2 years ago

pre-push sounds good for clippy!

ci failure is more painful for me because even with cache it takes two minutes to even get to the clippy command

ggold7046 commented 11 months ago

Hi, can anyone guide me on this issue about how to solve it ?