#1841 Skip TAGS_MISMATCH check if no English original exists

Closed
fbn_bmns wants to merge 1 commits from fbn_bmns/fsfe-website:fix/skip_tags_mismatch_check_no_en into master
  1. +5
    -0
      tools/githooks/pre-commit

+ 5
- 0
tools/githooks/pre-commit View File

@ -127,6 +127,11 @@ for f in $files_all; do
ext="${f##*.}"
# Get base file name (without) "en.$EXT"
base=$(echo "${f}" | sed -E "s/\.[a-z][a-z]\.${ext}//")
# exit TAGS_MISMATCH check if no english original exists
if [[ ! -e "$base.en.$ext" ]]; then
echo "No english original found for $f, skipping TAGS_MISMATCH check.."
max.mehl commented 2 months ago
Review

Please do not echo. The hook should only output if something is wrong

Please do not echo. The hook should only output if something is wrong
break
max.mehl commented 2 months ago
Review

IMHO break is not what we want. The whole for loop would halt, and therefore the next checks aborted.

I'd rather recommend to do it like this:

if [[ -e "$base.en.$ext" ]]; then
  # the existing checks here, up to line 142 in the current file
fi
IMHO `break` is not what we want. The whole `for` loop would halt, and therefore the next checks aborted. I'd rather recommend to do it like this: ```sh if [[ -e "$base.en.$ext" ]]; then # the existing checks here, up to line 142 in the current file fi ```
fi
# Extract tags from the translated and the English file, and sort them
tags_trans="$(grep -Ei '<tag(\s|\>)' "${f}" | perl -pe 's/.*<tag key="(.+?)".*/\1/' | sort)"
tags_en="$(grep -Ei '<tag(\s|\>)' "${base}.en.${ext}" | perl -pe 's/.*<tag key="(.+?)".*/\1/' | sort)"


Loading…
Cancel
Save