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>
This commit is contained in:
parent
14d97973b2
commit
8566b767a2
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue