Files
oam/.lefthook.yml
2024-02-28 14:53:08 +01:00

63 lines
1.6 KiB
YAML

---
assert_lefthook_installed: true
no_tty: true
skip_output:
- meta
- skips
- execution_out
validate:
parallel: true
commands:
json: &jq
# No official docker image available for now, falling back to the local
# command.
glob: "*.json"
run: jq -c '.' {all_files}
yaml: &yq
# Python's one, not mikefarah's.
# No official docker image available for now, falling back to the local
# command.
glob: "*.{yaml,yml}"
run: yq -c '.' {all_files}
lint:
parallel: true
commands:
hadolint: &hadolint
# The official docker image is based on scratch and only takes only one
# input file at a time. I have no clue how to fix that for now so let's
# just use the local command.
glob: "*Dockerfile*"
run: hadolint {all_files}
yamllint: &yamllint
glob: "*.{yaml,yml}"
run: >-
docker run --rm -v "$PWD:/code" 'registry.gitlab.com/pipeline-components/yamllint:latest'
yamllint {all_files}
pre-commit:
parallel: true
commands:
validate-json:
<<: *jq
run: jq -c '.' {staged_files}
validate-yaml:
<<: *yq
run: yq -c '.' {staged_files}
lint-docker:
<<: *hadolint
run: hadolint {staged_files}
lint-yaml:
<<: *yamllint
run: >-
docker run --rm -v "$PWD:/code" 'registry.gitlab.com/pipeline-components/yamllint:latest'
yamllint {staged_files}
commit-msg:
commands:
commitlint:
# No official docker image available for now, falling back to the local
# command.
run: commitlint -c '.commitlintrc.js' --edit