jenkins-bot has submitted this change and it was merged. Change subject: Hygiene: Add make phplint to Makefile and pre commit hook ......................................................................
Hygiene: Add make phplint to Makefile and pre commit hook It's running on Jenkins so let's run it on commits too Prevent commits when they have jshint, less, php errors Change-Id: I4abac7a5236baab843fa5b3924d431e767a10edc --- M Makefile A scripts/phpcheck.sh M scripts/pre-commit 3 files changed, 22 insertions(+), 3 deletions(-) Approvals: Kaldari: Looks good to me, approved jenkins-bot: Verified diff --git a/Makefile b/Makefile index fa4c3a2..ab7b57c 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,9 @@ checkless: @php ../../maintenance/checkLess.php +phplint: + @scripts/phpcheck.sh + phpunit: cd ${MW_INSTALL_PATH}/tests/phpunit && php phpunit.php --configuration ${MW_INSTALL_PATH}/extensions/MobileFrontend/tests/mfe.suite.xml --group=MobileFrontend diff --git a/scripts/phpcheck.sh b/scripts/phpcheck.sh new file mode 100755 index 0000000..593058e --- /dev/null +++ b/scripts/phpcheck.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# PHP Lint stuff before commiting +for file in `find . -name \*.php` +do + RESULTS=`php -l $file` + if [ "$RESULTS" != "No syntax errors detected in $file" ] + then + echo $RESULTS + exit 1 + fi +done diff --git a/scripts/pre-commit b/scripts/pre-commit index 81bd489..207fcb0 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -3,17 +3,21 @@ # Enable this pre-commit hook by executing the following from the project root directory # $ ln -s $PWD/scripts/pre-commit .git/hooks/pre-commit if git diff --name-only --cached | grep -P '\.less$' ; then - make checkless + make checkless || exit 1 fi -make jshint +make jshint || exit 1 if git diff --name-only --cached | grep -P '\.js$' ; then make qunit fi +if git diff --name-only --cached | grep -P '\.*php$' ; then + make phplint || exit 1 +fi if git diff --name-only --cached | grep -P 'includes/skins/.*php$' ; then - make validatehtml + make validatehtml > $result fi for file in `git diff --cached --name-only | grep ".png\$"` do [ -f $file ] && echo "Compressing $file" && \ optipng -q -o7 "$file" && advpng -z -4 "$file" && advdef -z -4 "$file" | grep "Output" || echo 'png was removed' done + -- To view, visit https://gerrit.wikimedia.org/r/95643 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4abac7a5236baab843fa5b3924d431e767a10edc Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: Awjrichards <aricha...@wikimedia.org> Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits