From 62b7999032f3a43eca59aef3819596c6b573edb4 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 28 Sep 2023 23:55:18 +0200 Subject: [PATCH] feat(tool): Add script to find untested Neon APIs Signed-off-by: jld3103 --- tool/find-untested-neon-apis.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tool/find-untested-neon-apis.sh diff --git a/tool/find-untested-neon-apis.sh b/tool/find-untested-neon-apis.sh new file mode 100755 index 00000000..57dfbfb1 --- /dev/null +++ b/tool/find-untested-neon-apis.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -euxo pipefail +cd "$(dirname "$0")/.." + +function find_apis() { + path="$1" + grep -r "$path" --include "*\.dart" -e "client\.[^.]*.[^(]*(" -oh | sed "s/^client\.//" | sed "s/($//" | sed "s/Raw$//" | sort | uniq +} + +used_apis=("$(find_apis "packages/neon")") +tested_apis=("$(find_apis "packages/nextcloud")") + +untested_apis=() + +for used_api in ${used_apis[*]}; do + tested=0 + + for tested_api in ${tested_apis[*]}; do + if [[ "$tested_api" == "$used_api" ]]; then + tested=1 + break + fi + done + + if [[ "$tested" == 0 ]]; then + untested_apis+=("$used_api") + fi +done + +if [[ -n "${untested_apis[*]}" ]]; then + printf "%s\n" "${untested_apis[@]}" + exit 1 +fi