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: If39fecb7781cc78b30cb95da354c71d3547b7ae7pull/1398/head
parent
18c4ad5584
commit
efd9b93652
|
@ -0,0 +1,10 @@
|
|||
#! /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
|
Loading…
Reference in New Issue