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

ext-ds round #2 #166

Closed
simPod opened this issue Mar 18, 2021 · 20 comments
Closed

ext-ds round #2 #166

simPod opened this issue Mar 18, 2021 · 20 comments

Comments

@simPod
Copy link
Contributor

simPod commented Mar 18, 2021

Describe the bug

So I had the issue with ext-ds before #87 which got fixed. Thanks!

Now installed this lib on another project and it reports unused ext-ds again. Not sure why though.

The file has use Ds\Set;

and a method is like

    protected function execute(InputInterface $input, OutputInterface $output) : int
    {
        $currentFiles = new Set(
        ...

Error dump

``` {"time":"2021-03-18T20:05:21.635042+00:00","level":"info","message":"version","context":{"value":"0.7.0"}} {"time":"2021-03-18T20:05:21.635436+00:00","level":"info","message":"requires","context":{"php":"^8.0","ext-ds":"*","Vendor\/entity-fqn-extractor":"^0.1.0","Vendor\/logging-integration-bundle":"dev-master as 0.1.0","spawnia\/sailor":"^0.3.0","symfony\/config":"^5.2","symfony\/console":"^5.2","symfony\/dependency-injection":"^5.2","symfony\/error-handler":"^5.2","symfony\/finder":"^5.2","symfony\/framework-bundle":"^5.2","symfony\/http-kernel":"^5.2","thecodingmachine\/safe":"^1.3","vlucas\/phpdotenv":"^5.3","webmozart\/assert":"^1.10"}} {"time":"2021-03-18T20:05:21.635464+00:00","level":"info","message":"dev-requires","context":{"Vendor\/coding-standard":"^4.0","hectorj\/safe-php-psalm-plugin":"dev-master as 1.3.0","icanhazstring\/composer-unused":"0.7.4","maglnet\/composer-require-checker":"^3.2","php-ds\/php-ds":"^1.3","phpstan\/extension-installer":"^1.0","phpstan\/phpstan":"^0.12.58","phpstan\/phpstan-mockery":"^0.12.7","phpstan\/phpstan-phpunit":"^0.12.17","phpstan\/phpstan-strict-rules":"^0.12.5","phpstan\/phpstan-webmozart-assert":"^0.12.12","phpunit\/phpunit":"^9.5","psalm\/plugin-phpunit":"^0.15.1","roave\/security-advisories":"dev-master","thecodingmachine\/phpstan-safe-rule":"^1.0","vimeo\/psalm":"^4.6"}} {"time":"2021-03-18T20:05:21.635486+00:00","level":"info","message":"autoload","context":{"psr-4":{"Vendor\\Project\\":["generated\/PhpSailor\/","src\/"]}}} {"time":"2021-03-18T20:05:21.635505+00:00","level":"info","message":"dev-autoload","context":{"psr-4":{"Vendor\\Project\\Tests\\":"tests\/"}}} {"time":"2021-03-18T20:05:21.714817+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/generated\/PhpSailor\/FlopApi\/EnabledSflowDevices.php","context":[]} {"time":"2021-03-18T20:05:21.727818+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/generated\/PhpSailor\/FlopApi\/EnabledSflowDevices\/EnabledSflowDevicesResult.php","context":[]} {"time":"2021-03-18T20:05:21.732516+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/generated\/PhpSailor\/FlopApi\/EnabledSflowDevices\/EnabledSflowDevices.php","context":[]} {"time":"2021-03-18T20:05:21.733637+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/generated\/PhpSailor\/FlopApi\/EnabledSflowDevices\/Devices\/Devices.php","context":[]} {"time":"2021-03-18T20:05:21.735022+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/sailor.php","context":[]} {"time":"2021-03-18T20:05:21.740026+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/tests\/bootstrap.php","context":[]} {"time":"2021-03-18T20:05:21.744057+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/tests\/TestCaseBase.php","context":[]} {"time":"2021-03-18T20:05:21.783792+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/src\/bootstrap.php","context":[]} {"time":"2021-03-18T20:05:21.787352+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/src\/Nfdump\/Application\/ConsoleCommand\/GenerateNfcapdConfig.php","context":[]} {"time":"2021-03-18T20:05:21.799781+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/src\/Nfdump\/Domain\/PathProvider.php","context":[]} {"time":"2021-03-18T20:05:21.801460+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/src\/CoreLibrary\/Symfony\/KernelContainerConfigurator.php","context":[]} {"time":"2021-03-18T20:05:21.809976+00:00","level":"debug","message":"Parsing file \/Users\/user\/project\/src\/Kernel.php","context":[]} ```

Additional information

I wonder how to debug. I can see it's scanning the file with ext-ds used in dump.

@icanhazstring
Copy link
Member

Hi @simPod thanks for reporting.
This seems weird 🤔

Let me have a look at it.

@icanhazstring
Copy link
Member

Hi @simPod I probably found the Issue. Will tag a new release soon.

@icanhazstring
Copy link
Member

Or probably not right now. This is the same issue with php requirement. If you don't have another package, requiring ext-ds. It will pop up as unused :(

However, this is fixed in the 0.8.x branch

icanhazstring pushed a commit that referenced this issue Jul 15, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
icanhazstring pushed a commit that referenced this issue Jul 15, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
@simPod
Copy link
Contributor Author

simPod commented Jul 17, 2021

🤔 I tried running 0.8.x and it reports

 Unused packages
 ✗ php
 ✗ ext-ds

even though

"extra": {
    "unused": [
        "ext-ds"
    ]
}

is specified

@icanhazstring
Copy link
Member

Can you give me your full comsoser.json?

@simPod
Copy link
Contributor Author

simPod commented Jul 17, 2021

{
    "name": "v/functions",
    "type": "library",
    "license": "proprietary",
    "keywords": [
        "php",
        "functions",
        "ds",
        "generators",
        "never"
    ],
    "authors": [
        {
            "name": "Simon Podlipsky",
            "email": "simon@podlipsky.net"
        }
    ],
    "config": {
        "sort-packages": true
    },
    "require": {
        "php": "^7.4 || ^8.0",
        "ext-ds": "*"
    },
    "autoload": {
        "files": ["src/functions_include.php"]
    },
    "autoload-dev": {
        "psr-4": {
            "Ns\\Functions\\Tests\\": "tests"
        }
    },
    "require-dev": {
        "ext-pcov": "*",
        "cdn77/coding-standard": "^5.0",
        "icanhazstring/composer-unused": "^0.7.6",
        "infection/infection": "^0.23.0",
        "maglnet/composer-require-checker": "^3.3",
        "phpstan/extension-installer": "^1.1",
        "phpstan/phpstan": "^0.12.92",
        "phpstan/phpstan-phpunit": "^0.12.21",
        "phpunit/phpunit": "^9.5",
        "psalm/plugin-phpunit": "^0.16.1",
        "roave/infection-static-analysis-plugin": "^1.8",
        "vimeo/psalm": "^4.8"
    },
    "extra": {
        "unused": [
            "ext-ds"
        ]
    }
}

@icanhazstring
Copy link
Member

Thanks. I'll try to replicate it. seems like something with the autoload.files directive.
With 0.7.x releases this always was also an issue.

Do you just have a single file that should be parsed which is using ext-ds?

@icanhazstring
Copy link
Member

What could also help, is a small code example having a composer.json with used dependencies and a codesample, that is using the extension but 0.8.x is reporting as unused. Then I could cover it with a test and fix it 👍

@simPod
Copy link
Contributor Author

simPod commented Jul 17, 2021

Sure, prepared this https://github.com/simPod/composer-unused-reproduce

@icanhazstring
Copy link
Member

icanhazstring commented Jul 17, 2021

Ah, sneaky one with a require inside the autoload file. I think I see where the problem is 😉

Good usecase, Thanks 💪

icanhazstring pushed a commit that referenced this issue Jul 31, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
icanhazstring pushed a commit that referenced this issue Jul 31, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
@icanhazstring
Copy link
Member

Hi @simPod I think I figured it out and updated the 0.8.x branch with an implementation that should be able to follow include expression statements. Can you give it a try?

@simPod
Copy link
Contributor Author

simPod commented Aug 1, 2021

@icanhazstring I tried with the "reproduce" repo mentioned above

32820  2021-08-01 10:51  cd composer-unused-reproduce
32821  2021-08-01 10:51  rm -rfd composer.lock vendor
32822  2021-08-01 10:51  composer install
32823  2021-08-01 10:51  composer unused

but the result seems unchanged

Results
-------

Found 0 used, 2 unused and 0 ignored packages

 Used packages

 Unused packages
 ✗ php
 ✗ ext-ds

 Ignored packages

@icanhazstring
Copy link
Member

icanhazstring commented Aug 1, 2021

Shouldn't have coded this in the middle of the night :D
Didn't see the __DIR__ directive so the path to parse the file is wrong, need to check for that as well ;)

Removing the __DIR__ should result in a working run ^^
Will fix it anyways tho 💪

@icanhazstring
Copy link
Member

This time it has to work!
Could you check @simPod ;)

@simPod
Copy link
Contributor Author

simPod commented Aug 2, 2021 via email

@icanhazstring
Copy link
Member

Awesome, thanks for the use case 💪

icanhazstring pushed a commit that referenced this issue Aug 2, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
icanhazstring pushed a commit that referenced this issue Sep 29, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
icanhazstring pushed a commit that referenced this issue Sep 29, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
@icanhazstring
Copy link
Member

Closing as its solved in 0.8.x

icanhazstring pushed a commit that referenced this issue Oct 4, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
icanhazstring pushed a commit that referenced this issue Nov 24, 2021
Ref: #166
Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
@simPod
Copy link
Contributor Author

simPod commented Dec 3, 2021

@icanhazstring When do you expect to release 0.8. Thanks!

@icanhazstring
Copy link
Member

Hi @simPod. I will probably strip down some additional features for 0.8 but I want the same features as before. So there are some still missing like required-by and suggested-by.

Also some minor bugs should be solved before releasing this. If I find some time I think I will release something around end of the year.

We could also make a faster release if there are some contributors willing to help me implement this stuff 😉

@simPod
Copy link
Contributor Author

simPod commented Dec 4, 2021

Thank you, just wanted to know what to ~expect. I'd help but currently I'm investing time in other OSS libs where issues burn me more (PHP81 stuff etc) 🙃

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

No branches or pull requests

2 participants