Page MenuHomePhabricator

mediawiki-codesniffer v37.0.0 conflicts with phpunit 9.5
Closed, ResolvedPublic

Description

The conflict seems to be via the sebastian/diff package. Upgrading codesniffer to v37 silently downgrades phpunit to 8.5, when you've got a "^8.5|^9.5" dependency on phpunit.

Problem 1
  - Conclusion: remove mediawiki/mediawiki-codesniffer v37.0.0
  - Conclusion: remove sebastian/diff 3.0.3
  - Conclusion: don't install phpunit/phpunit 9.5.7
  - Conclusion: don't install sebastian/diff 3.0.3
  - Conclusion: don't install phpunit/phpunit 9.5.6
  - Conclusion: don't install sebastian/diff 3.0.2
  - Conclusion: don't install phpunit/phpunit 9.5.5
  - Installation request for mediawiki/mediawiki-codesniffer 37.0.0 -> satisfiable by mediawiki/mediawiki-codesniffer[v37.0.0].
  - phpunit/phpunit 9.5.0 requires sebastian/diff ^4.0.3 -> satisfiable by sebastian/diff[4.0.3, 4.0.4].
  - phpunit/phpunit 9.5.1 requires sebastian/diff ^4.0.3 -> satisfiable by sebastian/diff[4.0.3, 4.0.4].
  - phpunit/phpunit 9.5.2 requires sebastian/diff ^4.0.3 -> satisfiable by sebastian/diff[4.0.3, 4.0.4].
  - phpunit/phpunit 9.5.3 requires sebastian/diff ^4.0.3 -> satisfiable by sebastian/diff[4.0.3, 4.0.4].
  - phpunit/phpunit 9.5.4 requires sebastian/diff ^4.0.3 -> satisfiable by sebastian/diff[4.0.3, 4.0.4].
  - Can only install one of: sebastian/diff[4.0.3, 3.0.0].
  - Can only install one of: sebastian/diff[4.0.4, 3.0.0].
  - mediawiki/mediawiki-codesniffer v37.0.0 requires sebastian/diff ~3 -> satisfiable by sebastian/diff[3.0.3, 3.0.0, 3.0.1, 3.0.2].
  - Conclusion: don't install sebastian/diff 3.0.1
  - Installation request for phpunit/phpunit ^9.5 -> satisfiable by phpunit/phpunit[9.5.0, 9.5.1, 9.5.2, 9.5.3, 9.5.4, 9.5.5, 9.5.6, 9.5.7].

As seen on I2d4dd3f87f07b1bbdcd87ea7f56cbfaa0c6f36ec where this downgrade causes difference in test results as reflected in the known failures list (which library upgrader committed as part of its patch).

Details

Event Timeline

The package was added as required with T209149 / https://gerrit.wikimedia.org/r/c/mediawiki/tools/codesniffer/+/647595

On the other side is codesniffer not using phpunit 9.5 right now and the conflict was not visible

I note that the sniffs themselves don't actually require sebastian/diff, its only the Gerrit-specific report formatter that does. To better support reuse of the sniffs by third parties, you might consider moving that report formatter to a different repo so those of us who don't need it don't have to be constrained by its dependencies.

@Tgr we could probably move the report into https://gitlab.wikimedia.org/KostaHarlan/fix-suggestions / https://packagist.org/packages/kostajh/fix-suggestions (ideally moving it into the wikimedia namespace), what do you think?

Sure. Repos which make use of the fix-suggestions command would then have to require both libraries, but that seems easy to coordinate.

Change 715291 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/tools/codesniffer@master] Remove GerritRobotComments PHPCS report

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

The patches are both merged, so a new version of mediawiki/tools/codesniffer could be released that doesn't include the GerritRobotComments formatter.

Change 715291 merged by jenkins-bot:

[mediawiki/tools/codesniffer@master] Remove GerritRobotComments PHPCS report

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

A new release 38.0.0 is available