Files
cozystack/.pre-commit-config.yaml
Myasnikov Daniil cc942fed68 test(tests): run unit suites with Bats and retain POSIX coverage
The shell translator rewrites test bodies and loses Bats reporting.
The unit lane needs complete TAP results and JUnit reports without
changing how live-cluster suites run.

Sourced production helpers still need a dash pass, and unit test bodies
need nounset without exporting shell options into subprocesses.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-10-07 11:04:00 +03:00

43 lines
2.0 KiB
YAML

repos:
- repo: local
hooks:
- id: run-make-generate-root
name: Run 'make generate' at repo root
entry: |
sh -c 'exec flock -x "$(git rev-parse --git-common-dir)/pre-commit.lock" "$@"' -- sh -c '
echo "Running make generate at repo root"
make generate || exit $?
git diff --color=always | cat
'
language: system
files: ^(api/|pkg/apis/|pkg/generated/|internal/crdinstall/manifests/|packages/system/cozystack-controller/definitions/|packages/system/application-definition-crd/definition/|packages/system/backup-controller/definitions/|packages/system/backupstrategy-controller/definitions/|hack/update-codegen\.sh$|hack/boilerplate\.go\.txt$|Makefile$)
pass_filenames: false
- id: run-make-generate
name: Run 'make generate' in all package directories
entry: |
sh -c 'exec flock -x "$(git rev-parse --git-common-dir)/pre-commit.lock" "$@"' -- sh -c '
hack/pre-commit-generate-packages.sh || exit $?
git diff --color=always | cat
'
language: system
files: ^.*$
# The complete hack/*.bats and POSIX-compatibility pass is intentionally a
# manual local hook because it requires bats-core and has substantial wall
# time even with GNU parallel. Run it before pushing with:
# pre-commit run bats-unit-tests --hook-stage manual --all-files
# Pull-request CI remains the unconditional gate.
- id: bats-unit-tests
name: Run hack/*.bats unit tests
entry: make bats-unit-tests bats-posix-compat-tests
language: system
stages: [manual]
pass_filenames: false
# Lints changed GitHub Actions workflows for unpinned actions and excessive token
# permissions (audit scope is set in .github/zizmor.yml). Runs offline so it needs
# no GitHub token locally. The same gate runs tree-wide in .github/workflows/zizmor.yml.
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.26.1
hooks:
- id: zizmor
args: [--offline]