-
Notifications
You must be signed in to change notification settings - Fork 563
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
Add pre-commit hook for running addlicense #1095
Conversation
The standard way to do this is expose a pre-commit hook from the addlicense repo, so that everyone can add it, and you don't need a shell script or a new |
Thanks for the pointer. I sent google/addlicense#143. Once accepted (I don't see why it wouldn't be...), we'll have to wait for them to do a release with a stable tag to use in the configs. I have another PR ready for when that happens. In the meantime, I found the docs that tell how to correctly setup a local hook and updated the code to do that. PTAL. |
It bothers me that pre-commit doesn't use Bazel for the binaries. The best way to deal with this is:
#!/usr/bin/env bash
set -o errexit -o nounset
cd "${BUILD_WORKSPACE_DIRECTORY}"
exec "${ADDLICENSE_BINARY}" "$@"
|
Pre-commit running Bazel is not great due to pre-commit/pre-commit#1003 (comment) |
Can we get this into a test? CI should fail on this. |
@rickeylev ping |
This Pull Request has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. |
This PR was automatically closed because it went 30 days without a reply since it was labeled "Can Close?" |
Integrate the addlicense.sh script with the pre-commit config so that it automatically runs when git committing.