Hello,
I have finally integrated PHP_CodeSniffer to report PHP style errors in MediaWiki core. PHP_CodeSniffer tokenises PHP and detects violations based on a set of coding standards.
You can get it running on your local installation by following the very lame install guide I wrote at mw.org :
https://www.mediawiki.org/wiki/Continuous_integration/PHP_CodeSniffer#instal...
Whenever a new patchset is uploaded in Gerrit, Jenkins will run phpcs on each file modified by the patchset and report the errors. The status points to the console for example:
https://integration.mediawiki.org/ci/job/mediawiki-core-phpcs-HEAD/30/consol...
From there click on the left on the Violations link to get a meaningful
report and a details of violations per file. Ex:
https://integration.mediawiki.org/ci/job/mediawiki-core-phpcs-HEAD/30/violat...
Don't worry, it is not going to block merge since the result status is actually ignored.
The set of rules is in mediawiki/tools/codesniffer.git : https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/tools/codesniffer.git
Reference: https://bugzilla.wikimedia.org/show_bug.cgi?id=35588
wikitech-l@lists.wikimedia.org