summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Kelemen <gabor.kelemen.extern@allotropia.de>2023-11-17 13:03:57 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2023-11-24 16:00:34 +0100
commit8566b767a24bc2c382391b6eb154f410c9f865b8 (patch)
tree66988e9910fada77ec57ee815a4987025c991492
parent14d97973b29c837583bc464b32c8e8b80eaa3642 (diff)
find-unused-configkeys: check groups that are not used as templates
listing these was lost in the previous commit Change-Id: I5b53c3fcf91db930570ac55e182041b5d54cc196 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159632 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
-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