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

Composer.json without require entries should not be an error #78

Closed
JoshuaBehrens opened this issue May 16, 2020 · 7 comments
Closed

Composer.json without require entries should not be an error #78

JoshuaBehrens opened this issue May 16, 2020 · 7 comments

Comments

@JoshuaBehrens
Copy link
Contributor

Describe the bug

A composer.json with no require entries seems to be a problem as the exit code is non zero and thus kills CI or other following scripts. Having nothing to check should not be per-se an error. When nothing is there to be checked anymore it is an error having this tool still required, check. When nothing is there to be checked yet is it not an error. This keeps me from preparing a repository so I can't use this tool without having a problem that I am not aware of yet.

Error dump

composer.json

{
    "name": "foo/bar",
    "description": "foobar",
    "type": "library",
    "minimum-stability": "stable",
    "extra": {
        "unused": [
            "php"
        ]
    },
    "require": {
        "php": ">=7.4 <7.5"
    },
    "autoload": {
        "psr-4": {
            "Foo\\Bar\\": "src/"
        }
    },
    "require-dev": {
        "phpunit/phpunit": ">=9.1 <10",
        "phpstan/phpstan": ">=0.12 <0.13",
        "phpstan/extension-installer": ">=1 <2",
        "phpstan/phpstan-phpunit": ">=0.12 <0.13",
        "phpstan/phpstan-deprecation-rules": ">=0.12 <0.13",
        "phpstan/phpstan-strict-rules": ">=0.12 <0.13",
        "psalm/plugin-phpunit": ">=0.10 <0.11",
        "vimeo/psalm": ">=3 <4",
        "infection/infection": ">=0.15 <0.16",
        "friendsofphp/php-cs-fixer": ">=2 <3",
        "icanhazstring/composer-unused": ">=0.7 <0.8"
    },
    "autoload-dev": {
        "psr-4": {
            "Foo\\Bar\\Test\\": "test/"
        }
    }
}

Command

vendor/bin/composer-unused --no-progress -vvv

Plugin command unused (Icanhazstring\Composer\Unused\Command\UnusedCommand) would override a Composer command and has been skipped
Running 1.10.6 (2020-05-06 10:28:10) with PHP 7.4.6 on Darwin / 19.3.0
You are running composer with Xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug

Loading packages
----------------

 ! [NOTE] Found 0 package(s) to be checked.                                                                             
                                                                                                                        
 [ERROR] No required packages found                                                                                                                                                                                                             

Log

{"time":"2020-05-16T15:12:01.071365+00:00","level":"info","message":"version","context":{"value":"0.7.0"}}
{"time":"2020-05-16T15:12:01.071514+00:00","level":"info","message":"requires","context":{"php":">=7.4 <7.5"}}
{"time":"2020-05-16T15:12:01.071529+00:00","level":"info","message":"dev-requires","context":{"phpunit\/phpunit":">=9.1 <10","phpstan\/phpstan":">=0.12 <0.13","phpstan\/extension-installer":">=1 <2","phpstan\/phpstan-phpunit":">=0.12 <0.13","phpstan\/phpstan-deprecation-rules":">=0.12 <0.13","phpstan\/phpstan-strict-rules":">=0.12 <0.13","psalm\/plugin-phpunit":">=0.10 <0.11","vimeo\/psalm":">=3 <4","infection\/infection":">=0.15 <0.16","friendsofphp\/php-cs-fixer":">=2 <3","icanhazstring\/composer-unused":">=0.7 <0.8"}}
{"time":"2020-05-16T15:12:01.071541+00:00","level":"info","message":"autoload","context":{"psr-4":{"Foo\\Bar\\":"src\/"}}}
{"time":"2020-05-16T15:12:01.071551+00:00","level":"info","message":"dev-autoload","context":{"psr-4":{"Foo\\Bar\\Test\\":"test\/"}}}
@icanhazstring
Copy link
Member

Hey @JoshuaBehrens. Thanks for reaching out. Of course this doesn't make sense at all.

I will see to it and change the behavior to a valid exit code. 👍

@JoshuaBehrens
Copy link
Contributor Author

Looking forward to it. When you need any help from my side just give me a note. I'd really like to use this tool 👍

@icanhazstring
Copy link
Member

Merged into master you could check if this works on your CI :)
If everything is fine I will tag this as next patch release. (as well as #79)

@JoshuaBehrens
Copy link
Contributor Author

Works like expected. Thanks for the fast responses and fixes. Keep up the great commitment 🥇 this is a very helpful tool that more people should be aware of 💯

@icanhazstring
Copy link
Member

Thank you ❤️
Will tag next release asap.

@icanhazstring
Copy link
Member

@JoshuaBehrens
Copy link
Contributor Author

🥳

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