Add a translation validation tool.#1653
Conversation
| phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p | ||
| fi | ||
| - | | ||
| if [[ $CHECK_TRANSLATION == yes ]]; then |
There was a problem hiding this comment.
Awesome work on the PHP side, but I have a little nitpick on the Travis/shellscript side. I think it makes more sense to just split it up in a bunch of true vars. :-)
env:
matrix:
- CHECK_TRANSLATION=1 # or true/yes/whatever
- CODE_SNIFFER=1
- PHP_UNIT=1
- CHECK_TRANSLATION=1 PHP_UNIT=1 # look, a combo!
Then the script is simply something like:
script:
- if [ "$CHECK_TRANSLATION" = 1 ]; then php tools/check.translation.php -r; fi
- if [ "$CODE_SNIFFER" = 1 ]; then phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p; fi
If more complicated scripts are desired in the future you can adapt it like:
- if [ "$SOMETHING" = something ]; then source .ci/something_whatever.sh; fi # or without source; but don't forget some kind of source common.sh in each script in that case
Implicitly, I also object to Bashisms like [[ $bla == lala ]] unless they bring something unique to the table. :-P
There was a problem hiding this comment.
I've done the source thing in the past but it can become a mess. I prefer having everything in the same file.
There was a problem hiding this comment.
I disagree as I think .travis.yml is horribly unsuited for evaluating the correctness of scripts. Even for simple one liners it's awkward, but that's neither here nor there. My example was poorly chosen because it suggests multiple files even though for our purposes a single script.sh would be much better for the foreseeable future.
What I'm saying is that I think explicit enabling of checks is more elegant than explicit everything.
PS
A .ci/script.sh would look like this:
#!/bin/bash
if [ "$CHECK_TRANSLATION" = 1 ] then
php tools/check.translation.php -r
fi
if [ "$CODE_SNIFFER" = 1 ] then
phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p
fi
tools/translation.ignore.php
Outdated
| $ignore['fr']['sub.php'][] = 'feed.description'; | ||
| $ignore['fr']['sub.php'][] = 'feed.number_entries'; | ||
|
|
||
|
|
There was a problem hiding this comment.
Stray newline. (I really am nitpicking today, aren't I. 👼 )
|
I've updated the code |
It's triggered by Travis to check what is missing.
|
Alright, cool! |
It's triggered by Travis to check what is missing.