libreoffice-online/scripts/unused-js-functions.sh
Jan Holesovsky efd9b93652 Trivial script to find unused functions in JavaScript
I haven't found any more advanced approach to finding unused JS
functions, but this seems to produce at least some results, so better
than nothing.

There is nothing new to remove though, the last round of cleanup has
removed what was there to remove.

Signed-off-by: Jan Holesovsky <kendy@collabora.com>
Change-Id: If39fecb7781cc78b30cb95da354c71d3547b7ae7
2021-02-03 13:54:46 +01:00

10 lines
396 B
Bash
Executable file

#! /bin/bash
find loleaflet/src/ -name "*.js" -exec grep ': function' \{\} \; | sed -e 's/:.*//' -e 's/^[\t ]*//' -e 's/[\t ]*$//' | grep -v " " | sort | uniq | \
while read FUNC ; do
NUM=`git grep "\<$FUNC\>" loleaflet/src/ | wc -l`
#echo "Trying $FUNC: $NUM"
if [ "$NUM" = "1" ] ; then
git --no-pager grep "\<$FUNC\>" loleaflet/src/
fi
done