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

Error on nonexistent PSR-4 directory #115

Closed JeroenBakker closed 3 months ago

JeroenBakker commented 3 months ago

Hi there,

This is more of a feature request/enhancement rather than a bug:

I came across the following error when running this excellent tool (the real paths are edited out):

$ vendor/bin/composer-dependency-analyser

'path-to-project/nonexistent-directory/' is not a file nor directory

This path was still listed in the the composer.json as a PSR-4 autoload directory for a namespace, but had been removed some time ago and the config was now unused.
Removing the line from the composer.json resolved the issue and allowed me to run the analysis to get the actual issues.

The error is correct, of course, but it feels like a missed opportunity to not report this as an unused composer configuration and continue with the rest of the analysis, the error was also a little confusing until I understood where it came from. If this kind of issue is out of scope (it isn't a dependency issue after all) it would be nice if the entry was simply ignored and the analysis continued without that path.

janedbal commented 3 months ago

the error was also a little confusing until I understood where it came from

Definitelly agree. I improved that in #117. But I decided to keep halting the analysis on such error.

JeroenBakker commented 3 months ago

That is fair enough, I don't foresee any situations where you couldn't simply remove it from the composer.json and move along, with a better error message this is trivial to fix 🙂