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

bug: packages of type metapackages always trigger unused dependency error #209

Open
doppynl opened this issue Dec 30, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@doppynl
Copy link

doppynl commented Dec 30, 2024

Description

When you require a package of the type "metapackage", a scan always gives the error:

Found 1 unused dependency!
(those are listed in composer.json, but no usage was found in scanned paths)

Metapackages don't come with any files and will not appear to be used by code in most cases.

It can be used to include other dependencies or make sure some packages or versions of packages are not installed. I mainly use it to trigger conflicts with packages that have a bug in specific versions.
https://getcomposer.org/doc/04-schema.md#type

Bug

A package with type "metapackage" should not trigger an unused dependency error.

Usage of code that is installed because it is required by a metapackage should obviously still trigger a shadow-dependency error.

Workaround

You can add configuration to not trigger the error like so:

$config->ignoreErrorsOnPackage('vendor/package-name' [ErrorType::UNUSED_DEPENDENCY])

But it doesn't really make sense to always have to do this for a metapackage.

@janedbal janedbal added the enhancement New feature or request label Dec 30, 2024
@stof
Copy link

stof commented Jan 7, 2025

An alternative way would be to mark a metapackage as unused when all its dependencies are unused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants