Page MenuHomePhabricator

Running PHPCS via Composer broken since July 2022
Closed, ResolvedPublic

Description

First observed in this CI build:

> composer phpcs
composer/installers contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins
You can run "composer config --no-plugins allow-plugins.composer/installers [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)
dealerdirect/phpcodesniffer-composer-installer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins
You can run "composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)
> phpcs -p -s
ERROR: Referenced sniff "SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing" does not exist

Run "phpcs --help" for usage information

Script phpcs -p -s handling the phpcs event returned with error code 3
Script composer phpcs handling the test event returned with error code 3

Somehow, the slevomat/coding-standard package doesn’t get installed quite properly (though it is in the composer install output), and then PHPCS crashes when it can’t load the sniff referenced in the PHPCS file. According to the quoted composer output, this seems to be due to the changed default of the allow-plugins config, where composer decided it was a great idea to have the default behavior change based on the calendar date, even if you install the same software version where everything worked previously. (See also T298283.)

Event Timeline

Change 810291 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Allow dealerdirect/phpcodesniffer-composer-installer plugin

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

So far, we’ve noticed this in Wikibase builds, but I wouldn’t be surprised if there are others. MediaWiki-extensions-Translate also seems to use SlevomatCodingStandard.* sniffs, for example.

So far, we’ve noticed this in Wikibase builds, but I wouldn’t be surprised if there are others. MediaWiki-extensions-Translate also seems to use SlevomatCodingStandard.* sniffs, for example.

Hm, no, Translate still seems to work, both in CI (gate-and-submit for this random change) and locally. Not sure why.

Change 810291 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Allow dealerdirect/phpcodesniffer-composer-installer plugin

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

Let’s leave the task open for a few more hours, since I think it might be helpful for other projects having the same issue; otherwise, I think we’re done here.

Change 842800 had a related patch set uploaded (by Addshore; author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@REL1_37] Allow dealerdirect/phpcodesniffer-composer-installer plugin

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

Change 842801 had a related patch set uploaded (by Addshore; author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@REL1_38] Allow dealerdirect/phpcodesniffer-composer-installer plugin

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

Change 842800 merged by Addshore:

[mediawiki/extensions/Wikibase@REL1_37] Allow dealerdirect/phpcodesniffer-composer-installer plugin

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

Change 849046 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@REL1_38] Lock data-values versions in composer.json

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

Change 849046 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@REL1_38] Lock data-values versions in composer.json

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

Change 842801 abandoned by Lucas Werkmeister (WMDE):

[mediawiki/extensions/Wikibase@REL1_38] Allow dealerdirect/phpcodesniffer-composer-installer plugin

Reason:

squashed into I2527a9fe48

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

Change 855601 had a related patch set uploaded (by Michael Große; author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@REL1_39] Lock data-values versions in composer.json

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

Change 879488 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@REL1_35] Allow dealerdirect/phpcodesniffer-composer-installer plugin

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

Change 879488 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@REL1_35] Allow dealerdirect/phpcodesniffer-composer-installer plugin

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