@@ -15,6 +15,8 @@ EOF
}
check_missing_docs () {
+ local ret=0
+
for v in $BUILT_INS
do
case "$v" in
@@ -34,6 +36,7 @@ check_missing_docs () {
if ! test -f "Documentation/$v.txt"
then
echo "no doc: $v"
+ ret=1
fi
if ! sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt |
@@ -43,20 +46,26 @@ check_missing_docs () {
git)
;;
*)
- echo "no link: $v";;
+ echo "no link: $v"
+ ret=1
+ ;;
esac
fi
done
+
+ return $ret
}
check_extraneous_docs () {
local commands="$(printf "%s\n" "$ALL_COMMANDS" "$BUILT_INS" "$EXCLUDED_PROGRAMS")"
+ local ret=0
while read how cmd
do
if ! [[ $commands = *"$cmd"* ]]
then
echo "removed but $how: $cmd"
+ ret=1
fi
done < <(
sed -e '1,/^### command list/d' \
@@ -70,13 +79,29 @@ check_extraneous_docs () {
sed -e 's|^|documented |' \
-e 's/\.txt//'
)
+
+ return $ret
}
BUILT_INS="$(extract_variable BUILT_INS)"
ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
-{
- check_missing_docs
- check_extraneous_docs
-} | sort
+findings=$(
+ if ! check_missing_docs
+ then
+ ret=1
+ fi
+
+ if ! check_extraneous_docs
+ then
+ ret=1
+ fi
+
+ exit $ret
+)
+ret=$?
+
+echo "$findings" | sort
+
+exit $ret
The "lint-manpages.sh" script does not return an error in case any of its checks fail. While this is faithful to the implementation that we had as part of the "check-docs" target before the preceding commit, it makes it hard to spot any violations of the rules via the corresponding CI job, which will of course exit successfully, too. Adapt the script to bubble up errors. Signed-off-by: Patrick Steinhardt <ps@pks.im> --- Documentation/lint-manpages.sh | 35 +++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-)