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

Add test #269

Merged
merged 3 commits into from
Jul 16, 2024
Merged

Add test #269

merged 3 commits into from
Jul 16, 2024

Conversation

VincentLanglet
Copy link
Owner

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (af956d3) to head (7459932).

❗ 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.
📢 Have feedback on the report? Share it here.


$reference = InstalledVersions::getReference(self::PACKAGE_NAME);
$version = $installed['versions'][$package]['pretty_version'] ?? 'dev';
$aliases = $installed['versions'][$package]['aliases'] ?? [];
Copy link
Owner Author

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 ?

Copy link
Contributor

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

Copy link
Owner Author

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.

Copy link
Owner Author

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Owner Author

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.

@VincentLanglet VincentLanglet merged commit 150694c into main Jul 16, 2024
16 checks passed
@VincentLanglet VincentLanglet deleted the addAppTest branch July 16, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants