Page MenuHomePhabricator

Implement PHP syntax validity (as SVN post commit hook)
Closed, DeclinedPublic

Description

Should check modified *.php and *.inc files on checkin with php -l and upload the results to CodeReview as test cases.

See current structure around parser tests in tools/checkin-test-trigger; need a standalone script to upload results in the proper format w/o the internal MW deps that parserTests' function requires.


Version: unspecified
Severity: enhancement

Details

Reference
bz20069

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:50 PM
bzimport set Reference to bz20069.
bzimport added a subscriber: Unknown Object (MLST).

Hmm, can this be done with a pre-commit svn hook?

Note: checkSyntax.php had been recently tweaked to be actually usable for such checks. It can now be run with --list-file option that allows to specify the list of files to check, instead of checking whole core (or even funnier, extensions).

  • Bug 24543 has been marked as a duplicate of this bug. ***

Retitling and adding dependancy

Post commit hook, pinging CR and setting fixme would be great

As a thing to this, we shouldn't blame users for syntax errors if they already exist on the file pre commit...

Any idea what we should do with this now, as we've got php -l pre commit?

Comment #5 is trivially fixed by ensuring we have no files with syntax errors.

We no longer have anyone in the whole trunk. There used to be one added on purpose in NamespaceCompat.php but it was removed in r70693.

find \( -name \*.php -or -name \*.inc \) -exec php -l \{\} \; | grep -v "No syntax errors detected"

(In reply to comment #7)

find \( -name \*.php -or -name \*.inc \) -exec php -l \{\} \; | grep -v "No
syntax errors detected"

I branched REL1_17 today, which caused the pre-commit hook to syntax-check a full copy of /trunk/phase3 and /trunk/extensions , which succeeded.