diff options
author | Ryota MIBU <r-mibu@cq.jp.nec.com> | 2015-12-15 11:22:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-12-15 11:22:01 +0000 |
commit | 4106697e71c5414f2f538722733ac35926b18514 (patch) | |
tree | 526af22e0219bd5c42461a062bd12c416a13a4d7 | |
parent | accf3cae9f93fe36c1742e38c5d9430a265356e3 (diff) | |
parent | b9e3d1e36b715316c9b823818cd96fbe4f484618 (diff) |
Merge "Adding doc8 check against rst files"
-rwxr-xr-x | utils/docs-build.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/docs-build.sh b/utils/docs-build.sh index bf9ab5b1e..5ac8b2be6 100755 --- a/utils/docs-build.sh +++ b/utils/docs-build.sh @@ -38,6 +38,26 @@ html_notes="\n Revision: $rev_full\n\n Build date: |today|" default_conf='releng/docs/etc/conf.py' opnfv_logo='releng/docs/etc/opnfv-logo.png' +function check_rst_doc() { + _src="$1" + + if ! which doc8 > /dev/null ; then + echo "Error: 'doc8' not found. Exec 'sudo pip install doc8' first." + exit 1 + fi + # Note: This check may fail in many jobs for building project docs, since + # the old sample has lines more than 120. We ignore failures on this + # check right now, but these have to be fixed before OPNFV B release. + _out=$(doc8 --max-line-length 120 "$_src") || { + _msg='Error: rst validatino (doc8) has failed, please fix the following error(s).' + _errs=$(echo "$_out" | sed -n -e "/^$_src/s/^/ /p") + echo + echo -e "$_msg\n$_errs" + echo + [[ -n "$GERRIT_COMMENT" ]] && echo -e "$_msg\n$_errs" >> "$GERRIT_COMMENT" + } +} + function add_html_notes() { _src="$1" _dir="$2" @@ -65,6 +85,8 @@ function add_config() { } +check_rst_doc $SRC_DIR + if [[ ! -d "$RELENG_DIR" ]] ; then echo "Error: $RELENG_DIR dir not found. See https://wiki.opnfv.org/documentation/tools ." exit 1 |