Debian Codegraph @

engine/hack/validate/yamllint

raw symbols SCIP
1 #!/usr/bin/env bash
2 set -e
3 SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4 source "${SCRIPTDIR}/.validate"
5
6 if [ -n "${TEST_FORCE_VALIDATE:-}" ]; then
7 files=(docs/api/*.yaml)
8 else
9 IFS=$'\n'
10 files=($(validate_diff --diff-filter=ACMR --name-only -- docs/*.yaml || true))
11 unset IFS
12 fi
13
14 # validate the yamllint configuration file before anything else
15 if out=$(yamllint -f parsable -d "{extends: default, rules: {document-start: disable}}" "${SCRIPTDIR}"/yamllint.yaml); then
16 echo "Congratulations! yamllint config file formatted correctly"
17 else
18 echo "${out}" >&2
19 false
20 fi
21
22 # Then validate GitHub actions workflows, and conditionally lint the swagger
23 # files in the docs directory, as these are large files and take some time.
24 if out=$(yamllint -f parsable -c "${SCRIPTDIR}"/yamllint.yaml .github/workflows/*.yml "${files[@]}"); then
25 echo "Congratulations! YAML files are formatted correctly"
26 else
27 echo "${out}" >&2
28 false
29 fi