summaryrefslogtreecommitdiff
path: root/bin/find-unused-configkeys.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/find-unused-configkeys.sh')
-rwxr-xr-xbin/find-unused-configkeys.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/find-unused-configkeys.sh b/bin/find-unused-configkeys.sh
index 1336044b21f5..d25b0ebb5469 100755
--- a/bin/find-unused-configkeys.sh
+++ b/bin/find-unused-configkeys.sh
@@ -11,12 +11,16 @@
for filename in $(find officecfg/ -name "*xcs"); do
for gs in group set node-ref; do
+ # Search for all nodes with the given node type $gs
for gname in $(git grep -aIh "<$gs" "$filename" 2>/dev/null | awk -F'oor:name="' '{print $2}' | awk -F'"' '{print $1}') ; do
+ # Check whether a group name appears outside of officecfg
if [ $(git grep -aI "$gname" 2>/dev/null | grep -saIv ^officecfg 2>/dev/null | wc -l) -eq 0 ] ;
then
# group, set or node-ref names may serve as oor:node-type templates
# check whether this is also unused - report only if both are unused
+ if [ $(git grep -aIh "oor:node-type=\"$gname" officecfg | wc -l ) -gt 0 ] ; then
for tmpl in $(git grep -aIh oor:node-type=\""$gname" officecfg 2>/dev/null | awk -F'oor:name="' '{print $2}' | awk -F '"' '{print $1}' ) ; do
+ # check whether the set is used outside of officecfg
if [ $(git grep -aI "$tmpl" 2>/dev/null | grep -saIv ^officecfg 2>/dev/null | wc -l) -eq 0 ];
then
echo "$gname group and $tmpl set in "$filename" appears only in officecfg";
@@ -27,6 +31,10 @@ for filename in $(find officecfg/ -name "*xcs"); do
fi
fi
done
+ # If it's not used in a template and does not appears outside, report
+ else
+ echo "$gname group/set/node-ref in "$filename" appears only in officecfg";
+ fi
fi
done
done