From: Thanh Ha Date: Thu, 3 May 2018 22:16:53 +0000 (-0400) Subject: Enable ensure-documented check X-Git-Tag: v0.22.0~16^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F22%2F10422%2F4;p=releng%2Fglobal-jjb.git Enable ensure-documented check This script is a dumb script that checks that there is an equivalent marking in docs/ for each yaml section. This patch also resolves a bug in the script where it was not detecting all undocumented items. Change-Id: Id33c8eae06e47256d53457eaa57c21cf7634ee19 Signed-off-by: Thanh Ha --- diff --git a/ensure-documented.sh b/ensure-documented.sh index cab15fcb..434e06c4 100755 --- a/ensure-documented.sh +++ b/ensure-documented.sh @@ -15,7 +15,7 @@ mapfile -t jjb_files < <(find jjb -name "*.yaml") undocumented_count=0 for file in "${jjb_files[@]}"; do - docs_interests=$(grep -e '\- builder:' \ + mapfile -t docs_interests < <(grep -e '\- builder:' \ -e '\- job-group:' \ -e '\- job-template:' \ -e '\- parameter:' \ @@ -25,11 +25,12 @@ for file in "${jjb_files[@]}"; do -e '\- trigger:' \ -e '\- wrapper:' \ -A1 "$file" \ - | grep 'name: ' | awk -F': ' '{print $2}' | awk -F"'" '{print $2}' | sort | uniq) + | grep 'name: ' | awk -F': ' '{print $2}' | sort | uniq \ + | tr -d "'") for item in "${docs_interests[@]}"; do if ! grep -q "$item" "docs/${file//.yaml/.rst}"; then - echo "$item" + echo "$file:$item" let "undocumented_count++" fi done diff --git a/tox.ini b/tox.ini index 2d4d91e6..8ed03446 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 1.6 -envlist = coala,jjb,jjb-compare-xml,license +envlist = coala,ensure-documented,jjb,jjb-compare-xml,license skipsdist = true [testenv:coala]