From d7214a7f1cbd9070a229d76b17e7b2bd7738f3ad Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 21 Apr 2023 09:10:04 +0200 Subject: [PATCH] hooks/pre-commit: run yamllint on more YAML files I keep messing up YAML syntax with values that have : in them... This doesn't work for all YAML files: * tests/metadata/dump/*.yaml have bad indenting * tests/metadata/*.yml have bad indenting, which is useful for tests --- .yamllint | 2 ++ examples/Vagrantfile.yaml | 1 + hooks/pre-commit | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.yamllint b/.yamllint index 6105b5d4..067a389e 100644 --- a/.yamllint +++ b/.yamllint @@ -2,4 +2,6 @@ extends: default rules: + document-start: disable line-length: disable + truthy: disable diff --git a/examples/Vagrantfile.yaml b/examples/Vagrantfile.yaml index 6bf9c5ca..276f0179 100644 --- a/examples/Vagrantfile.yaml +++ b/examples/Vagrantfile.yaml @@ -1,3 +1,4 @@ +--- # You may want to alter these before running ./makebuildserver diff --git a/hooks/pre-commit b/hooks/pre-commit index 4acfe2b5..3e872d69 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -13,7 +13,7 @@ if [ -z "$files" ]; then SH_FILES="hooks/pre-commit" BASH_FILES="gradlew-fdroid jenkins-build-all jenkins-setup-build-environment jenkins-test completion/bash-completion buildserver/provision-*" RB_FILES="buildserver/Vagrantfile" - YML_FILES="buildserver/*.yml examples/*.yml" + YML_FILES=".*.yml .yamllint */*.yml */*.yaml" else # if actually committing right now, then only run on the files # that are going to be committed at this moment @@ -36,7 +36,7 @@ else *.rb) RB_FILES+=" $f" ;; - *.yml) + *.yml|.*.yml|.yamllint) YML_FILES+=" $f" ;; *) @@ -139,7 +139,7 @@ for f in $RB_FILES; do done for f in $YML_FILES; do - if ! $YAMLLINT $f 1>/dev/null; then + if ! $YAMLLINT $f; then err ".yml tests failed on $f!" fi done