diff --git a/.travis.yml b/.travis.yml index d0dd11b..ea297dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ before_script: - pylint --errors-only ./testing script: + - ./scripts/lint-yaml-dirs - ./scripts/lint-json-dirs - pre-commit run --all-files --verbose - pytest diff --git a/requirements.txt b/requirements.txt index e2615fc..31179af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ demjson jsonschema pre-commit pylint +yamllint diff --git a/scripts/lint-yaml-dirs b/scripts/lint-yaml-dirs new file mode 100755 index 0000000..c135a21 --- /dev/null +++ b/scripts/lint-yaml-dirs @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Grab the execution directory +SCRIPT_DIR="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )")" +OUTPUT_SEP="===================================" + +# Define variables for the directory to lint +lintDirYaml() { + echo "JSONLINT - All files in dir $1." + echo $OUTPUT_SEP + for file in "$SCRIPT_DIR/../$1/"*.yaml; do + yamllint "$file" + exitStatus=$? + if [[ $exitStatus -ne 0 ]] + then + exit $exitStatus + fi + done + echo "" +} + +lintDirYaml "api"