feat(repo): validation rules for lefthook

This commit is contained in:
Michele Cereda
2024-02-28 14:53:08 +01:00
parent f01740a4cd
commit f803aea0c3

View File

@@ -1,6 +1,25 @@
--- ---
# assert_lefthook_installed: true assert_lefthook_installed: true
no_tty: 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: lint:
parallel: true parallel: true
@@ -20,10 +39,16 @@ lint:
pre-commit: pre-commit:
parallel: true parallel: true
commands: commands:
hadolint: validate-json:
<<: *jq
run: jq -c '.' {staged_files}
validate-yaml:
<<: *yq
run: yq -c '.' {staged_files}
lint-docker:
<<: *hadolint <<: *hadolint
run: hadolint {staged_files} run: hadolint {staged_files}
yamllint: lint-yaml:
<<: *yamllint <<: *yamllint
run: >- run: >-
docker run --rm -v "$PWD:/code" 'registry.gitlab.com/pipeline-components/yamllint:latest' docker run --rm -v "$PWD:/code" 'registry.gitlab.com/pipeline-components/yamllint:latest'
@@ -34,4 +59,4 @@ commit-msg:
commitlint: commitlint:
# No official docker image available for now, falling back to the local # No official docker image available for now, falling back to the local
# command. # command.
run: commitlint --edit run: commitlint -c '.commitlintrc.js' --edit