diff --git a/lefthook.yml b/lefthook.yml index ff57725dac684e05fa8cb7000e85533f1a599c71..161ce0b5155568566f94359a430c9ec5f8904fd1 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -18,6 +18,11 @@ pre-push: files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD glob: 'doc/*.md' run: yarn markdownlint {files} + yamllint: + tags: backend style + files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD + glob: '*.{yml,yaml}' + run: scripts/lint-yaml.sh {files} stylelint: tags: stylesheet css style files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD diff --git a/scripts/lint-yaml.sh b/scripts/lint-yaml.sh new file mode 100755 index 0000000000000000000000000000000000000000..c3bd7f2817e11b5f610c0390e66707e51a809b52 --- /dev/null +++ b/scripts/lint-yaml.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if ! command -v yamllint > /dev/null; then + echo "ERROR: yamllint is not installed. For more information, see https://yamllint.readthedocs.io/en/stable/index.html." + exit 1 +fi + +yamllint --strict -f colored "$@"