shipmonk-rnd / composer-dependency-analyser

🚀 Fast detection of composer dependency issues (unused dependencies, shadow dependencies, misplaced dependencies)
MIT License
332 stars 8 forks source link

exclude-from-classmap in autoload #136

Closed koekaverna closed 3 weeks ago

koekaverna commented 2 months ago

Hi, first of all I want to say thank you for this awesome tool!

I found that in composer.json autoload section there is a section "exclude-from-classmap" that can be helpfull to exclude tests for example.

Is it possible to add this logic to this tool? I work with legacy project and in my case some tests is in subfolder Test of project feature folders.

Example MyProject\Library\FeatureXyz\ MyProject\Library\FeatureXyz\Tests\

janedbal commented 2 months ago

It is theoretically possible to implement, but you can use $config->addPathToExclude(__DIR__ . '/Feature/tests') even now to achieve the same thing.

koekaverna commented 2 months ago

addPathToExclude

As I can see it doesn't support any patterns matching, in my scenario I have more than 100 folders like this :-)

janedbal commented 2 months ago

You can easily do some glob within the php config file, we are doing the same thing:

$config->addPathsToExclude(\Webmozart\Glob\Glob::glob(__DIR__ . '/bin/*.php'));