Browse Source

feat(tool): Add script to find untested Neon APIs

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/868/head
jld3103 1 year ago
parent
commit
62b7999032
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 33
      tool/find-untested-neon-apis.sh

33
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
Loading…
Cancel
Save