Page MenuHomePhabricator

Make mw-tools-codesniffer-mwcore-testrun job more like the actual mediawiki-core-phpcs job
Closed, ResolvedPublic

Description

Right now our testrun job doesn't use MediaWiki core's phpcs.xml file, so there's a lot of noise from $IP, $messageMemc, etc (at least I find it annoying). We should refactor the job so it produces identical output as running that version against core (i.e. use the phpcs.xml file).

Event Timeline

Legoktm raised the priority of this task from to Low.
Legoktm updated the task description. (Show Details)
Legoktm added subscribers: Legoktm, polybuildr.

I'm thinking...

  • zuul-cloner to fetch mw/tools/codesniffer and mw/core
  • cd mw/core
  • composer update
  • mv mw/tools/codesniffer -> mw/core/vendor/mediawiki/mediawiki-codesniffer
  • composer dump-autoload
  • mw/core/vendor/bin/phpcs -s -p

That doesn't handle cases where we change the phpcs version requirement.

That doesn't handle cases where we change the phpcs version requirement.

Is this the version requirement in the composer.json of mw/core? If so, why do we need to account for that?

Also, it would be nice if I could see the *diff* in the phpcs output after applying the new commit.

From https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/2.5.0:

  • PHPCS will now use a phpcs.xml file even if files are specified on the command line
    • This file is still only used if no standard is specified on the command line

Change 303802 had a related patch set uploaded (by Paladox):
Update MW codesniffer test core test to use mediawiki phpcs file

https://gerrit.wikimedia.org/r/303802

Change 434816 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[integration/config@master] Use mediawiki-phpcs-dryrun image

https://gerrit.wikimedia.org/r/434816

Change 434816 merged by jenkins-bot:
[integration/config@master] Use mediawiki-phpcs-dryrun image

https://gerrit.wikimedia.org/r/434816

Legoktm claimed this task.
Legoktm added subscribers: thiemowmde, Umherirrender.

FYI @Umherirrender and @thiemowmde

The way this job now works (simplified) is that it clones master of mediawiki/core, runs composer install --prefer-source, then checks out the new commit of codesniffer in vendor/mediawiki/mediawiki-codesniffer, and then runs phpcs.

This means that if a dependency changes, that won't be reflected, and any sniffs disabled in core's phpcs.xml won't be run either. If either of those changes interfere with your workflow, let me know and I can re-open this and adjust as necessary.

Change 303802 abandoned by Legoktm:
Update MW codesniffer test core test to use mediawiki phpcs file

Reason:
Unnecessary now.

https://gerrit.wikimedia.org/r/303802