Put extension parsing into a trait.
Closed this issue · 3 comments
The mechanism to parse extensions is coded in two different locations.
This should be done via a trait, to make the code DRY.
Lately I'm reconsidering the DRY-at-any-cost for the reason that most of the the more the code is DRY, the more it is coupled.
I really feel that for simple enough things it is better to repeat some logic, keeping code more readable and less coupled.
In this case I think we are at a boundary of what I consider "simple enough", and I already questioned myself if was the case to put the logic in just one place.
Even if we decide to do that there're things in the PR that I don't like, going to comment there.
I put extension parsing logic in a static function of FileExtensionPredicate
class.
The trim pattern is not hardcoded but accepted as argument of the method.
Code is DRY again :)