X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=ensure-documented.sh;h=530c2166b2725aa308daf0b34e4eb8a6b776c97a;hb=HEAD;hp=a2ca07217858836bb81d12a9a236dc92f3d20686;hpb=3577c6f3469752c9ff64742002a5b235d774001b;p=releng%2Fglobal-jjb.git diff --git a/ensure-documented.sh b/ensure-documented.sh index a2ca0721..530c2166 100755 --- a/ensure-documented.sh +++ b/ensure-documented.sh @@ -11,31 +11,31 @@ # Checks for JJB documentation interest points and ensures they are documented. -jjb_files=($(find jjb -name "*.yaml")) +mapfile -t jjb_files < <(find jjb -name "*.yaml") undocumented_count=0 for file in "${jjb_files[@]}"; do - docs_interests=$(grep -e '\- builder:' \ - -e '\- job-group:' \ - -e '\- job-template:' \ - -e '\- parameter:' \ - -e '\- property:' \ - -e '\- publisher:' \ - -e '\- scm:' \ - -e '\- trigger:' \ - -e '\- wrapper:' \ - -A1 "$file" \ - | grep 'name: ' | awk -F': ' '{print $2}' | awk -F"'" '{print $2}' | sort | uniq) + mapfile -t docs_interests < <(grep -e '\- builder:' \ + -e '\- job-template:' \ + -e '\- parameter:' \ + -e '\- property:' \ + -e '\- publisher:' \ + -e '\- scm:' \ + -e '\- trigger:' \ + -e '\- wrapper:' \ + -A1 "$file" \ + | grep 'name: ' | awk -F': ' '{print $2}' | sort | uniq \ + | tr -d "'" | tr -d '"') for item in "${docs_interests[@]}"; do if ! grep -q "$item" "docs/${file//.yaml/.rst}"; then - echo "$item" - let "undocumented_count++" + echo "$file:$item" + undocumented_count=$((undocumented_count+1)) fi done done -if [ $undocumented_count -gt 0 ]; then +if [ "$undocumented_count" -gt 0 ]; then echo "Number of undocumented items: $undocumented_count" exit 1 fi