github.com/eikeon/docker@v1.5.0-rc4/project/make/validate-toml (about)

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