From 03a3a5c02d1b8308ade0379337ff71c147a1a1b6 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 4 Sep 2020 16:22:23 -0700 Subject: [PATCH] scripts: Add check_format test for JSON-RPC documentation All JSON-RPCs must be documented in jsonrpc.md Change-Id: Iec9119a01433fd0cbe4df4477ce94cc2feeb0d54 Signed-off-by: Ben Walker Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4074 Tested-by: SPDK CI Jenkins Reviewed-by: Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Monica Kenguva Community-CI: Mellanox Build Bot --- scripts/check_format.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index 67343a8cdb..9d25f3c906 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -567,6 +567,19 @@ function check_changelog() { return $rc } +function check_json_rpc() { + local rc=0 + + while IFS='"' read -r _ rpc _; do + if ! grep -q "^## $rpc" doc/jsonrpc.md; then + echo "Missing JSON-RPC documentation for ${rpc}" + rc=1 + fi + done < <(git grep -h "^SPDK_RPC_REGISTER(" ':!test/*') + + return $rc +} + rc=0 check_permissions || rc=1 @@ -593,5 +606,6 @@ check_python_style || rc=1 check_bash_style || rc=1 check_bash_static_analysis || rc=1 check_changelog || rc=1 +check_json_rpc || rc=1 exit $rc