-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add test #269
Add test #269
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #269 +/- ##
=============================================
+ Coverage 99.15% 100.00% +0.84%
Complexity 720 720
=============================================
Files 64 64
Lines 2241 2234 -7
=============================================
+ Hits 2222 2234 +12
+ Misses 19 0 -19 ☔ View full report in Codecov by Sentry. |
src/Console/Application.php
Outdated
|
||
$reference = InstalledVersions::getReference(self::PACKAGE_NAME); | ||
$version = $installed['versions'][$package]['pretty_version'] ?? 'dev'; | ||
$aliases = $installed['versions'][$package]['aliases'] ?? []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@llaville I didn't found a single lib in vendor/composer/installed.php
which have an alias. I'm thinking about changing
if (null === $reference) {
return $aliases[0] ?? $version;
}
to
if (null === $reference) {
return $version;
}
What would I lose ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you have only one branch, or if don't specify a composer branch constraint, you won't see the difference.
For example:
Twig-CS-Fixer dev-main@af956d3
But when you've project with multiple branches, you are able to see immediatly the difference.
For example: (do it on your repo local copy)
git checkout -b 3.0
composer update
bin/twig-cs-fixer --version
And you should see something like
Twig-CS-Fixer 3.0.x-dev@af956d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried
git checkout -b 3.0
composer update
bin/twig-cs-fixer --version
and i get
Twig-CS-Fixer 3.0.x-dev@af956d3
even if I removed the alias code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can try it on this branch if you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is Composer that do the magic job. Look into vendor/composer/installed.php
file,
and you'll get.
'vincentlanglet/twig-cs-fixer' => array(
'pretty_version' => '3.0.x-dev',
'version' => '3.0.9999999.9999999-dev',
'reference' => 'af956d3e56a8766f66a3e28f9bba25f35a85a943',
'type' => 'coding-standard',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
As pretty version has a highter priority in our implementation, you think alias do nothing, but it's not the case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without pretty version
$version = null//$installed['versions'][self::PACKAGE_NAME]['pretty_version']
?? $installed['versions'][self::PACKAGE_NAME]['version']
?? 'dev';
you'll get Twig-CS-Fixer 3.0.9999999.9999999-dev@af956d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, you'll have the last word.
The most important is to provide a version that allow to identify this application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try like this, since I cannot test the alias ; I'll see later if it need to be revert.
No description provided.