IonBazan / composer-diff

Compares composer.lock changes and generates Markdown report so you can use it in PR description.
https://packagist.org/packages/ion-bazan/composer-diff
MIT License
143 stars 6 forks source link

Add "changed" status, refactor #6

Closed IonBazan closed 3 years ago

IonBazan commented 3 years ago

This PR introduces new operation type: Changed which represents an operation where at least one of the components is referencing a branch/commit or a version constraint (for platform dependencies).

Among with the refactoring, there are following breaking changes:

codecov[bot] commented 3 years ago

Codecov Report

Merging #6 (b44fcd2) into master (4fcbe58) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##              master        #6   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       141       162   +21     
===========================================
  Files             16        19    +3     
  Lines            386       430   +44     
===========================================
+ Hits             386       430   +44     
Impacted Files Coverage Δ
src/Composer/Plugin.php 100.00% <ø> (ø)
src/Command/DiffCommand.php 100.00% <100.00%> (ø)
src/Diff/DiffEntries.php 100.00% <100.00%> (ø)
src/Diff/DiffEntry.php 100.00% <100.00%> (ø)
src/Diff/VersionComparator.php 100.00% <100.00%> (ø)
src/Formatter/AbstractFormatter.php 100.00% <100.00%> (ø)
src/Formatter/JsonFormatter.php 100.00% <100.00%> (ø)
src/Formatter/MarkdownListFormatter.php 100.00% <100.00%> (ø)
src/Formatter/MarkdownTableFormatter.php 100.00% <100.00%> (ø)
src/PackageDiff.php 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4fcbe58...b44fcd2. Read the comment docs.

IonBazan commented 3 years ago

@trakos Please check if this solves your issue. Comparing these dev- parts is quite tricky so let me know if it's returning an expected result. Please check the test cases for more info.

trakos commented 3 years ago

@IonBazan thanks a lot, yes it does :) I use composer 2, and it shows Changed as expected for dev- versions.

I've also checked the test cases I mentioned in the issue and it shows Changed for all of them :)

IonBazan commented 3 years ago

Good to hear! I am still thinking about implementing custom version comparison logic instead of using VersionParser and Semver as they produce slightly different results between different Composer versions to make it more consistent. The thing is that there is tons of logic behind it so I will most probably leave it as is. That's because the operation name is not that important as showing correct base and target versions.