? ? Success

User tests: Successful: Unsuccessful:

avatar zero-24
zero-24
10 Oct 2016

Summary of Changes

This should run a php -l on the code

Testing Instructions

See that travis not fails

Documentation Changes Required

None

Suggestions?

Any suggestions here for the Script?

Credits

Travis script based on: https://hakre.wordpress.com/2015/11/10/linting-php-files-in-parallel-on-travis/

56e1941 10 Oct 2016 avatar zero-24 move
avatar zero-24 zero-24 - open - 10 Oct 2016
avatar zero-24 zero-24 - change - 10 Oct 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 10 Oct 2016
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 10 Oct 2016
Category Unit Tests
avatar zero-24 zero-24 - change - 10 Oct 2016
The description was changed
avatar andrepereiradasilva
andrepereiradasilva - comment - 10 Oct 2016

IMHO, for consistency, you should use a variable like RUN_PHPSYNTAXCHECK="yes" and then is that var is yes run the bash script

Also doesn't php syntax check result be difference across php versions? if so, it needs to be checked in all supported php version.

avatar mbabker
mbabker - comment - 10 Oct 2016

Also doesn't php systax check result be difference across php versions? if so,, so it needs to be checked in all supported php version.

Yep. Because each branch has different deprecation warnings and allowed syntax (like the report at #12380 will only happen with PHP 7.x but not 5.x, likewise if we tried linting https://github.com/joomla/joomla-cms/blob/staging/libraries/vendor/composer/autoload_static.php it would fail on PHP 5.5 and earlier but it's not an issue because that file isn't included by Composer on those PHP versions).

avatar andrepereiradasilva
andrepereiradasilva - comment - 11 Oct 2016

with something like this

if [[ $RUN_PHP_SYNTAX_CHECK == "yes" ]]; then bash build/travis/php-syntax-check.sh; fi

build/travis/php-syntax-check.sh

#!/bin/bash
# Script for php/hhvm syntax check in Joomla!

RUN_COMMAND="php -d display_errors=stderr -n -l"

if [[ $TRAVIS_PHP_VERSION = hhvm ]]; then RUN_COMMAND="hhvm -d display_errors=stderr -l"; fi

find . \( -path ./libraries/vendor -o -path ./libraries/phpass -o -path ./libraries/fof -o -path ./tests -o -wholename './administrator/components/com_joomlaupdate/restore.php' \) -prune -o -type f -name "*.php" -print | xargs -n1 -P8 $RUN_COMMAND 1>/dev/null

we can faster lint tests (around 75s in php7 - was 107s here) and test also in hhvm
notice i removed the lint test for fof and unit tests
maybe it could be faster, by messing with the find command

5c182e7 15 Oct 2016 avatar zero-24 typo
ea38d6d 15 Oct 2016 avatar zero-24 test
avatar zero-24
zero-24 - comment - 15 Oct 2016

Thanks @andrepereiradasilva It works now.

See here for a systax error: https://travis-ci.org/joomla/joomla-cms/jobs/167874647
And here if it works without problems: https://travis-ci.org/joomla/joomla-cms/jobs/167876323

I have also added excluded more 3rd Party folders.

So i think we are good to go here?

avatar andrepereiradasilva andrepereiradasilva - test_item - 16 Oct 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 16 Oct 2016

I have tested this item successfully on 8469b8a

works fine.
the only "issue" here is that it delays all unit tests more than 75s
but i guess we have to live with that ...


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12379.

avatar zero-24 zero-24 - change - 25 Oct 2016
Milestone Added:
avatar zero-24
zero-24 - comment - 27 Oct 2016

Any reason to not merge this?

avatar zero-24
zero-24 - comment - 31 Oct 2016

Is there no interest in merging this so we can close here? @rdeutz @wilsonge ?

avatar zero-24 zero-24 - change - 31 Oct 2016
The description was changed
avatar rdeutz
rdeutz - comment - 31 Oct 2016

travis runs already long enough so adding more stuff to it makes it run even longer

avatar zero-24 zero-24 - change - 31 Oct 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-10-31 12:16:02
Closed_By zero-24
avatar zero-24 zero-24 - close - 31 Oct 2016
avatar zero-24 zero-24 - close - 31 Oct 2016
avatar zero-24 zero-24 - close - 31 Oct 2016
avatar zero-24
zero-24 - comment - 31 Oct 2016

Closing than ?

avatar zero-24 zero-24 - head_ref_deleted - 31 Oct 2016
avatar andrepereiradasilva
andrepereiradasilva - comment - 5 Jun 2017

@zero-24 maybe you can add this to drone, instead of travis. not sure if possible.

At least PHP CS is way faster in drone (around 25s) that was in travis (around 150s)

avatar rdeutz
rdeutz - comment - 6 Jun 2017

we have an infrastructure sprint in tow weeks and we will look if we ca run syntax checks as part of the pipeline we than have setup

Add a Comment

Login with GitHub to post a comment