build: add pre-commit tooling + basic go/shell/yaml hooks

docs: mention pre-commit
This commit is contained in:
Marc 2024-11-10 10:01:22 -05:00
parent 91094b9360
commit 8f0489a622
Signed by: marc
GPG key ID: 048E042F22B5DC79
3 changed files with 28 additions and 0 deletions

16
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,16 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
- repo: https://github.com/tekwizely/pre-commit-golang
rev: master
hooks:
- id: go-test-mod
- id: go-fmt
- id: go-vet-mod

View file

@ -22,3 +22,7 @@ curl https://forge.karnov.club/spadinastan/spud/raw/branch/main/install.sh | bas
To pull a specific version, supply a `$SPUD_VERSION` that corresponds to an existing release tag, and to control where To pull a specific version, supply a `$SPUD_VERSION` that corresponds to an existing release tag, and to control where
the binary is unpacked and installed, supply `$SPUD_ROOT`. the binary is unpacked and installed, supply `$SPUD_ROOT`.
## Development
The `bootstrap.sh` script should be run to prepare any pre-commit hooks and other required tooling for local development. Checks can be run manually via `pipx run pre-commit run -a`.

8
bootstrap.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
if [[ -z "$(command -v pipx)" ]]; then
echo "ERROR: Pre-commit tooling requires pipx to be available."
exit 1
fi
pipx run pre-commit install