validate-toml 671 B

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