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

Improve normalisation of inline aliases #889

Merged
merged 11 commits into from
May 2, 2023

Conversation

fredden
Copy link
Contributor

@fredden fredden commented Apr 17, 2023

This pull request

  • Removes useless aliasing of the same version (1.2.3 as 1.2.3 --> 1.2.3).
  • Ensures only a single space is used around the as keyword (1.4.5 as 1.2.3 --> 1.4.5 as 1.2.3). Previous to this change, only pairs of spaces were removed ( --> , --> ); this change now reduces all repeated spaces into a single space for consistency ( --> , --> ).
  • Adds more tests to cover changes being made.
  • Updates tests with more accurate name ('branch alias' --> 'inline alias'), and to match upstream documentation.

@localheinz - please feel free to squash-merge this or rebase / change commits as you see fit.

@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

Merging #889 (dc83275) into main (339991a) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head dc83275 differs from pull request most recent head 44ca02a. Consider uploading reports for the commit 44ca02a to get more accurate results

@@             Coverage Diff              @@
##               main     #889      +/-   ##
============================================
+ Coverage     97.49%   97.53%   +0.03%     
- Complexity      158      160       +2     
============================================
  Files            30       30              
  Lines           679      690      +11     
============================================
+ Hits            662      673      +11     
  Misses           17       17              
Impacted Files Coverage Δ
...rc/Vendor/Composer/VersionConstraintNormalizer.php 97.61% <100.00%> (+0.22%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@fredden
Copy link
Contributor Author

fredden commented Apr 17, 2023

For reference, I have seen both 1.2.3 as 1.2.3 and 1.4.5 as 1.2.3 in the wild. This typically comes about when a specific version constraint is in place in a dependency, and the current project wants a newer version of some package.

For example:

  • Package A requires package B at version 1.2.3.
  • Package B follows semantic versioning.
  • Package B releases version 1.2.4 to fix some bug.
  • Root package requires package A.
  • Root package wants the bug-fix, so uses an inline alias: 1.2.4 as 1.2.3.
  • Later, some other feature is released for package B, which the root package wants, so the inline alias is changed to 1.4.5 as 1.2.3.
  • A new version of package A is released requiring version 1.4.5.
  • Root package alias is mistakenly updated to be 1.4.5 as 1.4.5.

I can supply concrete packages and versions if required.

@localheinz localheinz merged commit 7d7e73e into ergebnis:main May 2, 2023
@localheinz
Copy link
Member

Thank you, @fredden!

@fredden fredden deleted the inline-alias branch May 2, 2023 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants