pytorch/docs/cpp/check-doxygen.sh
Peter Goldsborough e6d6aed12e Check doxygen output in travis (#11124)
Summary:
This PR adds a .travis.yml check for our C++ documentation. The goal is to avoid any documentation/comments in our C++ code that would break the doxygen output and possibly ruin the C++ documentation site (currently https://pytorch.org/cppdocs).

For this, we:
1. Run doxygen and record any warnings,
2. Filter out some known bogus warnings,
3. Count the remaining warnings,
4. Fail the check if (3) is non-zero.

soumith
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11124

Differential Revision: D9651011

Pulled By: goldsborough

fbshipit-source-id: 30f776d23bb6d6c482c54db32828b4b99547e87b
2018-09-05 10:25:56 -07:00

33 lines
868 B
Bash
Executable File

#!/bin/bash
set -ex
ignore_warning() {
# Invert match to filter out $1.
grep -v "$1" doxygen-log.txt > temp.txt
mv temp.txt doxygen-log.txt
}
# Run doxygen and log all output.
doxygen 2> original-doxygen-log.txt
cp original-doxygen-log.txt doxygen-log.txt
echo "Original output"
cat original-doxygen-log.txt
# Filter out some warnings.
ignore_warning "warning: no uniquely matching class member found for"
ignore_warning "warning: source ../../build/aten/src/ATen/Tensor.h is not a readable file"
ignore_warning "warning: source ../../build/aten/src/ATen/Functions.h is not a readable file"
# Count the number of remaining warnings.
warnings=$(grep 'warning:' doxygen-log.txt | wc -l)
if [[ $warnings != 0 ]]; then
cat original-doxygen-log.txt
rm -f doxygen-log.txt original-doxygen-log.txt
exit 1
fi
rm -f doxygen-log.txt original-doxygen-log.txt