diff options
author | Gabor Kelemen <gabor.kelemen.extern@allotropia.de> | 2023-11-09 14:16:22 +0100 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2023-11-11 18:30:30 +0100 |
commit | 23e106034e86b13a00a5039486c3d6bb57f98382 (patch) | |
tree | 8e598d45c631bb7f60a9d5bfd1538ee922cc591b /bin | |
parent | 1ec76f7a38124b28521fd5959419cf189e65d9f1 (diff) |
find-unused-configkeys: check whether sets...
are used at all, if they have an otherwise unused group as template
TODO: Still gives some false positives if a group is only used
as template of a set which is only used as template of another
set which is actually used (MergeToolBarInstruction MergeStatusBarInstruction)
Change-Id: Ia2f83c12a4e0bdcc88b1530bac4daaf456531f8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159297
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/find-unused-configkeys.sh | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/bin/find-unused-configkeys.sh b/bin/find-unused-configkeys.sh index 9a159da23ebc..1336044b21f5 100755 --- a/bin/find-unused-configkeys.sh +++ b/bin/find-unused-configkeys.sh @@ -11,14 +11,22 @@ for filename in $(find officecfg/ -name "*xcs"); do for gs in group set node-ref; do - for gname in $(git grep -h "<$gs" "$filename" | awk -F'oor:name="' '{print $2}' | awk -F'"' '{print $1}') ; do - if [ $(git grep "$gname" | grep -v ^officecfg | wc -l) -eq 0 ] ; + for gname in $(git grep -aIh "<$gs" "$filename" 2>/dev/null | awk -F'oor:name="' '{print $2}' | awk -F'"' '{print $1}') ; do + 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 - if [ $(git grep "$gname" officecfg | grep oor:node-type | wc -l ) -eq 0 ] ; - then - echo "$gname group in "$filename" appears only in officecfg"; - fi + # check whether this is also unused - report only if both are unused + 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 + 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"; + else + if [ $(git grep -aI "$gname" officecfg 2>/dev/null | grep -saI oor:node-type 2>/dev/null | wc -l ) -eq 0 ] ; + then + echo "$gname group in "$filename" appears only in officecfg"; + fi + fi + done fi done done |