-
Notifications
You must be signed in to change notification settings - Fork 175
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
feature: add pre-commit support #138
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
seems reasonable to me on the surface. Some missing context here is that "pre-commit" seems to refer to https://pre-commit.com/ (and https://github.com/pre-commit). So it looks like we would just add this repos:
- repo: https://github.com/google/addlicense
rev: v1.1.1
hooks:
- id: addlicense
args: [ "-c", "Company, Inc", "*.go" ] We don't need a Maybe add a comment at the top of the file that indicates that this is for use with pre-commit.com ? |
thanks a lot for your advice. Yes, exactly. Your code snippet is the way i meant how addlicense can be used as a pre-commit hook. Good point with the comment. How about a extension in the readme with a code snippet to makes it clear how running addlicense with pre-commit? For example: Running with pre-commitThis is the official pre-commit hook for addlicense. Activate by adding it to your repos:
- repo: https://github.com/google/addlicense
rev: '' # Use the sha / tag you want to point at
hooks:
- id: addlicense
args: [ "-c", "Company, Inc", "*.go" ] |
55d63a7
to
a1c4e56
Compare
a1c4e56
to
4b673a0
Compare
@mco-gh @willnorris Would one of you be willing to review/merge this PR? I, too, would like pre-commit to Just Work with addlicense |
Would someone be able to merge pre-commit hook support? It seems like #160 is all ready and valid but just needs someone to merge it. |
Hi guys,
great tool. I have looked around and this tool is exactly what i am looking for.
I would like to use your tool in combination with pre-commit. The cool thing is then to run your tool during git hooks.
I have seen that for example the project golangci-lint also provide this pre-commit integration.
https://github.com/golangci/golangci-lint/blob/master/.pre-commit-hooks.yaml
If you have questions, feel free to ask me.
Kind Regards,
Thomy90