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 support for pre-commit #465
Conversation
Changes: * .pre-commit-hooks.yaml: defines this shfmt repo as a hook for pre-commit * .github/workflows/release.yml: make sure .pre-commit-hooks.yaml is in sync with release tag
Changes: * .pre-commit-config.yaml: uses pre-commit on this repo * .github/workflows/test.yml: run pre-commit in Github Actions CI pipeline
|
I'm conflicted about this PR. I see the value in pre-commit hooks, but this adds nearly a hundred lines of code for me to maintain. I'm not sure I see the point of all this machinery, when in reality running In the past, I've welcomed "downstream" contributions like packaging shfmt for Linux distros, but I haven't been involved simply because there is too much work and I can't keep up with the 20+ ways to distribute software. I simply publish git tags with binaries, and a Docker image, since that last bit is very little work for me and does seem like a very popular request. I think pre-commit falls under the kind of downstream work that I'd prefer others to maintain. If someone must maintain these files, it should be possible for it to happen in a separate git repository. We can then link that from https://github.com/mvdan/sh#related-projects. |
|
Up to you. If you're not interested feel free to close the PR. |
|
Thanks for understanding. I'll close this for now, but I'm still happy to add links to other repos or projects in the README. |
|
The only necessary file is Not sure why the other stuff was proposed here :S |
| name: shfmt shell scripts | ||
| description: Format shell scripts with shfmt running in Docker | ||
| language: docker_image | ||
| entry: mvdan/shfmt:v3.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be language: go and entry: shfmt
|
(with my recommendations and only shipping |
|
I mean, sure, I can add a short yaml file with some simple metadata. I'm not sure why that's necessary or useful, though, or why it couldn't be in another repo. Edit: To clarify, I just mean in the context of #465 (comment). Running shfmt in CI or as part of scripts is already trivial, and as a rule I don't write downstream packages. I don't see why I should break that rule here. |
pre-commit is infrastructure to easily set up running any set of tools as git pre-commits on a repo. A tool only needs to provide a hook description (.pre-commit-hook.yaml) in its repo to become usable by the pre-commit infrastructure.
Here I'm adding this hook description, which makes shfmt easily usable by pre-commit (see added example in README.md). I'm also turning pre-commit loose on this repo and configure it to run automatically on the Github Actions CI pipeline on every push and pull request.