]> granicus.if.org Git - esp-idf/blob - docs/check_doc_warnings.sh
Merge branch 'feature/python_future' into 'master'
[esp-idf] / docs / check_doc_warnings.sh
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 RESULT=0
7 STARS='***************************************************'
8
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
17 # Remove escape characters, file paths, line numbers from
18 # the Sphinx warning log
19 # (escape char removal from https://www.commandlinefu.com/commands/view/6141/remove-color-codes-special-characters-with-sed
20 sed -r 's:\x1B\[[0-9;]*[mK]::g' sphinx-warning-log.txt | \
21     sed -E "s~${IDF_PATH}~\${IDF_PATH}~" | \
22     sed -E "s/:[0-9]+:/:line:/" > sphinx-warning-log-sanitized.txt
23
24 # diff sanitized warnings, ignoring lines which only appear in ../sphinx-known-warnings.txt
25
26 # format is to display only lines new or changed in second argument
27 DIFF_FORMAT="--unchanged-line-format= --old-line-format= --new-line-format=%L"
28
29 SPHINX_WARNINGS=$(diff $DIFF_FORMAT ../sphinx-known-warnings.txt sphinx-warning-log-sanitized.txt)
30 if ! [ -z "$SPHINX_WARNINGS" ]; then
31     echo "$STARS"
32     echo "Build failed due to new/different Sphinx warnings:"
33     echo "$SPHINX_WARNINGS"
34     echo "$STARS"
35     RESULT=1
36     echo "(Check files ../sphinx-known-warnings.txt and sphinx-warning-log.txt for full details.)"
37 fi
38
39 exit $RESULT
40