Skip to content
Snippets Groups Projects

Issue #3344127: Composer validate all fixture manipulation changes

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
225 231 'name' => 'composer/plugin-b',
226 232 'version' => '20.1',
227 233 'type' => 'composer-plugin',
228 ],
229 ],
230 [],
231 ];
232
233 yield 'one UNsupported but disallowed plugin' => [
  • I removed it because I think we don't need this test case anymore. This case handles the situation where we have a unsupported plugin but it's not disallowed or allowed in 'allow-plugins' and now we validate composer in FixtureManipulator this case gives a error

    composer/plugin-c contains a Composer plugin which is blocked by your allow  
      -plugins config. You may add it to the list if you consider it safe.         
      You can run "composer config --no-plugins allow-plugins.composer/plugin-c [  
      true|false]" to enable it (true) or disable it explicitly and suppress this  
       exception (false)

    and if I fix it by adding it in 'allow-plugins' i.e. doing

    'allow-plugins' => [
              // Definitely NOT `composer/plugin-c`!
              'drupal/core-project-message' => TRUE,
              'composer/plugin-c' => FALSE,
            ],

    in our test case, then it's mostly testing the same thing as the preceding case.

    Edited by Kunal Sachdev
  • You're right that we would catch this now.

    But what about real sites? They won't be running composer validate all the time.

    That's why I think we should still have this.

  • Ted Bowman changed this line in version 13 of the diff

    changed this line in version 13 of the diff

  • Author Maintainer

    I have created The Composer project must pass validation in order to use Package Manager which would mean we would not have to deal with invalid Composer setup in individual validators.

    So I think it ok to remove this case if there is a @todo pointing to this issue ensure that we handle invalid projects in general

    Edited by Ted Bowman
  • Instead of removing this case, I commented it out with a todo.

  • Please register or sign in to reply
  • 163 182 if ($should_exist && isset($is_dev_requirement)) {
    164 183 throw new \LogicException('Changing an existing project to a dev requirement is not supported');
    165 184 }
    185 // To pass Composer validation all packages must have a version specified.
    186 if (!$should_exist && $package && !isset($package['version'])) {
    187 $package['version'] = '1.2.3';
    188 }
    • Comment on lines +185 to +188

      :thinking: Should we not instead require that all setPackage() calls specify a version?

      This is fine to get this MR going, but once this is green I think we should remove it and replace it with:

      Suggested change
      185 // To pass Composer validation all packages must have a version specified.
      186 if (!$should_exist && $package && !isset($package['version'])) {
      187 $package['version'] = '1.2.3';
      188 }
      185 // To pass Composer validation all packages must have a version specified.
      186 if (!$should_exist && $package && !isset($package['version'])) {
      187 throw new \LogicException('Composer requires each package to have a version.');
      188 }
    • Ted Bowman changed this line in version 12 of the diff

      changed this line in version 12 of the diff

    • Please register or sign in to reply
  • Kunal Sachdev added 1 commit

    added 1 commit

    • 073719ea - resolved failure in ComposerPatchesValidatorTest

    Compare with previous version

  • Ted Bowman added 1 commit

    added 1 commit

    Compare with previous version

  • Ted Bowman added 1 commit

    added 1 commit

    Compare with previous version

  • Ted Bowman added 1 commit

    added 1 commit

    Compare with previous version

  • Ted Bowman
    Ted Bowman @tedbow started a thread on the diff
  • 357 380 * @param string $dir
    358 381 * The directory to commit the changes to.
    359 382 */
    360 protected function doCommitChanges(string $dir): void {
    383 final protected function doCommitChanges(string $dir): void {
  • Ted Bowman added 2 commits

    added 2 commits

    Compare with previous version

  • Ted Bowman added 2 commits

    added 2 commits

    Compare with previous version

  • Ted Bowman added 1 commit

    added 1 commit

    Compare with previous version

  • Ted Bowman
  • Ted Bowman
    Ted Bowman @tedbow started a thread on the diff
  • 40 40 */
    41 41 private string $dir;
    42 42
    43 /**
    44 * Validate the fixtures still passes `composer validate`.
    45 */
    46 private function validateComposer(): void {
    47 /** @var \PhpTuf\ComposerStager\Domain\Service\ProcessRunner\ComposerRunnerInterface $runner */
    48 $runner = \Drupal::service('PhpTuf\ComposerStager\Domain\Service\ProcessRunner\ComposerRunnerInterface');
    49 $runner->run([
    50 'validate',
    51 // @todo Check the lock file in https://drupal.org/i/3343827.
    52 '--no-check-lock',
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading