From ff3c9480567245a7a860c60476ad7df7f96a3baf Mon Sep 17 00:00:00 2001 From: Aitor Date: Fri, 16 Feb 2024 13:29:50 +0100 Subject: [PATCH] :paperclip: Add script to find missing mf/use-fn --- frontend/scripts/find-mf-use-fn.sh | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 frontend/scripts/find-mf-use-fn.sh diff --git a/frontend/scripts/find-mf-use-fn.sh b/frontend/scripts/find-mf-use-fn.sh new file mode 100755 index 0000000000..b408037f40 --- /dev/null +++ b/frontend/scripts/find-mf-use-fn.sh @@ -0,0 +1,31 @@ +#!/bin/bash +echo -e "\x1B[0;41mmf/use-fn\x1B[0m\n" + +# +# Get count of expressions +# +FN_COUNT=$(egrep -rn ":on-.*?\s+\(fn" src/app/main/ui | wc -l) +PARTIAL_COUNT=$(egrep -rn ":on-.*?\s+\(partial" src/app/main/ui | wc -l) +AFN_COUNT=$(egrep -rn ":on-.*?\s+#\(" src/app/main/ui | wc -l) + +# +# Show counts +# +echo -e ":on-.*? (fn \x1B[0;31m" $FN_COUNT "\x1B[0m" +echo -e ":on-.*? (partial \x1B[0;31m" $PARTIAL_COUNT "\x1B[0m" +echo -e ":on-.*? #(\x1B[0;31m" $AFN_COUNT "\x1B[0m\n" + +echo -e "total: \x1B[0;31m" $((FN_COUNT + PARTIAL_COUNT + AFN_COUNT)) "\x1B[0m\n" + +# Show summary or show file list +if [[ $1 == "-s" ]]; then + # + # Files with handlers that don't use mf/use-fn + # + egrep -rn ":on-.*?\s+#?\((fn|partial)" src/app/main/ui | egrep -o "src/app/.*?\.cljs:" | uniq +else + # + # List files with lines + # + egrep -rn ":on-.*?\s+#?\((fn|partial)" src/app/main/ui | egrep -o "src/app/.*?\.cljs:([0-9]+)" +fi