From 9754ae292a516a54a5c619cb47e52f545652847a Mon Sep 17 00:00:00 2001 From: thmsdt Date: Mon, 3 Apr 2023 13:16:38 +0200 Subject: [PATCH] doc check updated (multiple tox.ini) Issue-ID: DOC-811 Signed-off-by: thmsdt Change-Id: Iea0786b6a691d2f8940c50f41638e84f93d8c21e --- jjb/doc/rules.yaml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/jjb/doc/rules.yaml b/jjb/doc/rules.yaml index 702449035..7618f7d1e 100644 --- a/jjb/doc/rules.yaml +++ b/jjb/doc/rules.yaml @@ -35,15 +35,18 @@ . /lib/lsb/init-functions || exit 0 exitstatus="0" warning="0" + # message, begin log_success_msg "Starting additional checks related to documentation." log_success_msg "See https://git.onap.org/doc/doc-best-practice for example config files (master branch)." log_success_msg "Modify example config files if you like to use them in a release branch." log_success_msg "See https://wiki.onap.org/x/w4IEBw for the detailed procedure #02." log_success_msg "In case of questions please contact the ONAP documentation team." + # docs directory if [ ! -d docs ] ; then log_success_msg "Directory docs not found. Skipping further checks." exit 0 fi + # config files, required for i in docs/index.rst docs/conf.py docs/requirements-docs.txt docs/_static/css/ribbon.css; do if [ ! -f $i ] ; then log_failure_msg "$i missing. Please add it or remove the full docs directory." @@ -52,6 +55,7 @@ log_success_msg "$i found." fi done + # config files, no longer required for i in docs/conf.yaml; do if [ -f $i ] ; then log_failure_msg "$i found. It is no longer required. Please remove it." @@ -60,12 +64,14 @@ log_success_msg "$i not found." fi done + # tox.ini @ docs directory filename="docs/tox.ini" if [ ! -f $filename ] ; then log_failure_msg "$filename missing. Please add it or remove the full docs directory." exitstatus="1" else log_success_msg "$filename found." + # sphinx-build command and -W option sphinxbuild_detected=0 linenumber=0 while IFS="" read -r line || [ -n "$line" ] ; do @@ -75,7 +81,7 @@ if echo $line | grep -q '^[ \t]*sphinx-build.* -W ' ; then log_success_msg "sphinx-build option '-W' used in $filename, line $linenumber." elif echo $line | grep -q ' \-b spelling ' ; then - log_warning_msg "sphinx-build option '-W' not used for spellcheck in $filename, line $linenumber." + log_warning_msg "sphinx-build option '-W' missing for spellcheck in $filename, line $linenumber." warning="1" else log_failure_msg "sphinx-build option '-W' missing in $filename, line $linenumber. Please add it." @@ -87,16 +93,26 @@ log_failure_msg "Sphinx-build command(s) missing in $filename. Please add it." exitstatus="1" fi + # second tox.ini @ root directory + if [ -f ./tox.ini ] ; then + # sphinx-build command + if cat ./tox.ini | grep -q '^[ \t]*sphinx-build.*' ; then + log_warning_msg "tox.ini also exists in root directory and contains sphinx-build command(s). Please check for redundancies." + warning="1" + fi + fi unset sphinxbuild_detected unset linenumber fi unset filename + # ribbon.css filename="docs/_static/css/ribbon.css" if [ ! -f $filename ]; then log_failure_msg "$filename missing. Please add it or remove the full docs directory." exitstatus="1" else log_success_msg "$filename found." + # max-width parameter cssmaxwidth=$(grep '^[ \t]*max-width:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//'); if [[ ! $cssmaxwidth == *"max-width: 800px"* ]]; then log_failure_msg "Setting 'max-width: 800px' missing in $filename. Please add it." @@ -107,6 +123,7 @@ unset cssmaxwidth fi unset filename + # message, end if [ "$exitstatus" = "0" ]; then if [ "$warning" = "0" ]; then log_success_msg "Congratulations! No documentation problem(s) detected." @@ -114,6 +131,9 @@ log_warning_msg "No major documentation problem(s) detected but there are warnings!" fi else + if [ ! "$warning" = "0" ]; then + log_warning_msg "Please check the detected documentation warning(s)!" + fi log_failure_msg "Please fix the detected documentation problem(s)!" fi exit $exitstatus -- 2.16.6