Open Mayron opened 3 months ago
Hey there,
in the past i've already encounter some classes where they just had 1-5 public methods, but they also had a couple of hundred private methods, which in my eyes is still a thing.
I would assume that the counter should be applied to all methods and if necessary the thresholds can be changed easily, so u could configure a suitable solution.
There is an existing option to set the maximum methods per class. However, after reading the clean code book I noticed the author emphasizes only being able to do 1 or 2 things per class from a usability perspective and encapsulate data as much as possible.
This plugin allows you to configure the maximum methods per class, but that also includes private methods. So, technically I could have 20 public methods, which I believe should break the single responsibility principle.
If a class was an aggregate root (using the DDD term) or an MVC controller, then it might have many public methods. I was mainly thinking of service classes where the limit should be smaller. Ideally, we could configure it on a namespace-level or class-level but that's far outside the scope of this extension.
Either way, it would be beneficial to at least be able to give public methods a different maximum value that by default is smaller than the maximum number of total methods. It could be somewhere around 5-10 instead of 20.
It's up for debate, of course, but I wanted to see what you think :)