[chore, CI] Ensure no whitespace between gettext() call and string (#4530)

Follow-up to https://github.com/koreader/koreader/pull/4524

The regex in the Python wasn't actually picking up on that style of writing it at all, because it's not only ugly, but also so counter-intuitive that I overlooked to test for and add support for it.

```
_(
[[
```

It'd be easy to fix up the Python regex a little, and perhaps I will,
but either way it makes more sense to automatically enforce this as a coding standard.
pull/4535/head
Frans de Jonge 5 years ago committed by GitHub
parent b68cdc202d
commit c0c4bcdace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,10 +23,17 @@ fi
tab_detected=$(grep -P "\\t" --include \*.lua --exclude={dateparser.lua,xml.lua} --recursive {reader,setupkoenv,datastorage}.lua frontend plugins spec || true)
if [ "${tab_detected}" ]; then
echo -e "\\n${ANSI_RED}Error TAB character detected"
echo -e "\\n${ANSI_RED}Warning: tab character detected. Please use spaces."
echo "${tab_detected}"
exit 1
fi
newline_split=$(grep -Pzo "(_|gettext)\((\n|\s)+('|\"|\[\[)" --include \*.lua --exclude={dateparser.lua,xml.lua} --recursive {reader,setupkoenv,datastorage}.lua frontend plugins spec || true)
if [ "${newline_split}" ]; then
echo -e "\\n${ANSI_RED}Warning: whitespace detected between gettext() call and string."
echo "${newline_split}"
exit 1
fi
echo -e "\n${ANSI_GREEN}Luacheck results"
luajit "$(which luacheck)" --no-color -q {reader,setupkoenv,datastorage}.lua frontend plugins spec

Loading…
Cancel
Save