3 # Copyright (c) 2021 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
19 WS_ROOT=$( realpath ${SCRIPTDIR}/../.. )
21 function red () { printf "\e[0;31m$1\e[0m\n" ; }
22 function green () { printf "\e[0;32m$1\e[0m\n" ; }
25 find ${WS_ROOT}/docs -type l \
26 \( -name '*.rst' -o -name '*.md' \) \
27 -exec readlink -f {} \; | sort
30 find_excluded_docs () {
31 cat ${WS_ROOT}/docs/docsignore \
33 | sed s@^@${WS_ROOT}/@ \
37 find_linked_and_excluded_docs () {
38 cat <( find_linked_docs ) <( find_excluded_docs ) | sort
41 find_candidate_docs () {
46 -not -path "${WS_ROOT}/test/venv/*" \
47 \( -name '*.rst' -o -name '*.md' \) \
52 make -C ${WS_ROOT} docs-spell
55 if [ "x$(comm -13 <( find_linked_and_excluded_docs ) <( find_candidate_docs ))" != x ]; then
56 red "The following files need to be linked"
57 red "in the doc folder e.g. :"
58 red "$ cd vpp/docs/developer/plugins"
59 red "$ ln -s ../../../src/plugins/my_plugin/my_plugin.rst"
61 cat <( comm -13 <( find_linked_and_excluded_docs ) <( find_candidate_docs ) )
65 green "**********************************************"
66 green "* VPP Docs Checkstyle Successfully Completed *"
67 green "**********************************************"