Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated NpmRepository to skip broken versions #308

Merged
merged 3 commits into from
Sep 27, 2017

Conversation

SilverFire
Copy link
Contributor

Related to hiqdev/asset-packagist#68

Some packages have dependencies with corrupted version constraints.
The change allows composer-asset-plugin to omit these versions.

$packages[] = $loader->load($config);
} catch (\UnexpectedValueException $exception) {
// Most probably version constraint is broken.
// Skip this version and hope that another one will be OK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a warning or notice, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done

$this->io->write("<warning>Skipped {$config['name']} version {$version}: {$exception->getMessage()}</warning>", IOInterface::VERBOSE);
continue;
} catch (\Exception $exception) {
throw $exception;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why catch it if you don't do anything with it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SilverFire See my previous review, because it is past in outdated status with your new update, but it's not the case: this catch is unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think this can be removed, you're just catching and throwing the exception again :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opps. It used id for debug to place breakpoint on throw $exception, then I just forgot to remove it. Thank you for pointing out, friends :)

// Most probably version constraint is broken.
// Skip this version and hope that another one will be OK
continue;
} catch (\Exception $exception) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This catch is unnecessary.

@francoispluchino francoispluchino added this to the 1.4.1 milestone Sep 25, 2017
// Most probably version constraint is broken.
// Skip this version and hope that another one will be OK
$this->io->write("<warning>Skipped {$config['name']} version {$version}: {$exception->getMessage()}</warning>", IOInterface::VERBOSE);
continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • continue is not necessary
  • remove comments because the output message is explicit

And it will be good for me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments because the output message is explicit

the message says much less than the comment. should probably improve the message to say, why the version was skipped.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$exception->getMessage() will include the exact reason, e.g. "Could not parse version constraint >=1.1.0,,<2.0: Invalid version string "1.1.0,,<2.0"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm for keeping the comment then, it does not hurt and provides more context.

@francoispluchino francoispluchino merged commit cc13b39 into fxpio:master Sep 27, 2017
@francoispluchino
Copy link
Member

@SilverFire Thank you!

@SilverFire
Copy link
Contributor Author

Thank you too

@francoispluchino francoispluchino modified the milestones: 1.4.1, 1.4 May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants