TomasVotruba / class-leak

Find leaking classes that you never use... and get rid of them.
https://tomasvotruba.com/blog/how-to-avoid-maintaining-classes-you-dont-use
MIT License
75 stars 6 forks source link

Specify skipped classes via a config file #8

Closed NoiseByNorthwest closed 8 months ago

NoiseByNorthwest commented 1 year ago

Specifying the skipped class list via a flag is not ideal when the list has tens or more entries. Is it planned to add something like a config file where we could comfortably maintain this list ?

TomasVotruba commented 1 year ago

Hi, I had such design in my mind before but to push it as soon as possible, I went for the CLI.

So I'd like to give it a go :) Would you like to contribute this?

NoiseByNorthwest commented 1 year ago

Yes I could make the patch, but I'm not sure what design you had in your mind. A simple yaml file specified via a "-c" flag ? And containing only a "skippedClasses" top level property ?

TomasVotruba commented 1 year ago

Yeah, that could be good start 👍

jeslopcru commented 1 year ago

Hi! First, thank you for releasing this tool, I was trying and the result was quite impressive. I'm wondering if it could be possible to exclude some directories or maybe it is enough with a configuration file

I run class-leak in a Symfony web application and the result returned a few of false positives like:

***
Application\Migrations\Version20220523104411
***
Common\Infrastructure\Security\OwnerVoter
***
Common\UserInterface\Controller\SwaggerController
***

I hope that the PR https://github.com/TomasVotruba/class-leak/pull/9 will be released soon 🤞🏼

TomasVotruba commented 8 months ago

Hi, I'm revisiting this idea and it would lead to quite complex and ambiguious setup. My vision behind this package is to keep it as lean and slim as possible.

Yet, there are now 2 options to skip suffix/type that would help out: https://github.com/TomasVotruba/class-leak#usage

@jeslopcru Just a tip: as for migrations, I'd remove them from app, as they're generated and not a code you want to run tools on. We move it to /migrations directory to stay away from ECS, Rector and PHPStan.