check_doc_warnings.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. #
  3. # Check for Documentation warnings:
  4. # doxygen-warning-log.txt should be an empty file
  5. # sphinx-warning-log.txt should only contain (fuzzy) matches to sphinx-known-warnings.txt
  6. cd "$(dirname $0)"
  7. RESULT=0
  8. STARS='***************************************************'
  9. if [ -s doxygen-warning-log.txt ]; then
  10. echo "$STARS"
  11. echo "Build failed due to doxygen warnings:"
  12. cat doxygen-warning-log.txt
  13. echo "$STARS"
  14. RESULT=1
  15. fi
  16. # Remove escape characters, file paths, line numbers from
  17. # the Sphinx warning log
  18. # (escape char removal from https://www.commandlinefu.com/commands/view/6141/remove-color-codes-special-characters-with-sed
  19. sed -r 's:\x1B\[[0-9;]*[mK]::g' sphinx-warning-log.txt | \
  20. sed -E "s~${IDF_PATH}~\${IDF_PATH}~" | \
  21. sed -E "s/:[0-9]+:/:line:/" > sphinx-warning-log-sanitized.txt
  22. # diff sanitized warnings, ignoring lines which only appear in sphinx-known-warnings.txt
  23. # format is to display only lines new or changed in second argument
  24. DIFF_FORMAT="--unchanged-line-format= --old-line-format= --new-line-format=%L"
  25. SPHINX_WARNINGS=$(diff $DIFF_FORMAT sphinx-known-warnings.txt sphinx-warning-log-sanitized.txt)
  26. if ! [ -z "$SPHINX_WARNINGS" ]; then
  27. echo "$STARS"
  28. echo "Build failed due to new/different Sphinx warnings:"
  29. echo "$SPHINX_WARNINGS"
  30. echo "$STARS"
  31. RESULT=1
  32. echo "(Check files sphinx-known-warnings.txt and sphinx-warning-log.txt for full details.)"
  33. fi
  34. exit $RESULT