github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/validate/toml (about) 1 #!/usr/bin/env bash 2 3 export SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 4 source "${SCRIPTDIR}/.validate" 5 6 IFS=$'\n' 7 files=($(validate_diff --diff-filter=ACMR --name-only -- 'MAINTAINERS' || true)) 8 unset IFS 9 10 badFiles=() 11 for f in "${files[@]}"; do 12 # we use "git show" here to validate that what's committed has valid TOML syntax 13 if ! git show "$VALIDATE_HEAD:$f" | tomlv /proc/self/fd/0; then 14 badFiles+=("$f") 15 fi 16 done 17 18 if [ ${#badFiles[@]} -eq 0 ]; then 19 echo 'Congratulations! All TOML source files changed here have valid syntax.' 20 else 21 { 22 echo "These files are not valid TOML:" 23 for f in "${badFiles[@]}"; do 24 echo " - $f" 25 done 26 echo 27 echo 'Please reformat the above files as valid TOML' 28 echo 29 } >&2 30 false 31 fi