ugettext messages can't be preceded by a newline, even though it's valid python
@@ -15,8 +15,19 @@ set -euo pipefail
echo "black --target-version py37 --check TWLight"
if black --target-version py37 --check TWLight
then
+ # https://phabricator.wikimedia.org/T255167
+ echo "Checking for localization issues"
+ if _newline=$(find TWLight -name "*.py" -type f -print0 | xargs -0 pcregrep --color=always -Mn '_\(\n[ \t]*(.*)\n[^)]*\)')
+ then
+ echo "ERROR: ugettext messages can't be preceded by a newline, even though it's valid python"
+ printf "${_newline}\n"
+ exit 1
+ else
+ echo "No localization issues found"
# Run test suite via coverage so we can get a report without having to run separate tests for it.
- DJANGO_LOG_LEVEL=CRITICAL DJANGO_SETTINGS_MODULE=TWLight.settings.local coverage run --source TWLight manage.py test --keepdb --noinput
+ DJANGO_LOG_LEVEL=CRITICAL DJANGO_SETTINGS_MODULE=TWLight.settings.local \
+ coverage run --source TWLight manage.py test --keepdb --noinput
+ fi
else
# If linting fails, offer some useful feedback to the user.
black --target-version py37 --quiet --diff TWLight
