NuKeeperDotNet / NuKeeper

Automagically update nuget packages in .NET projects
Apache License 2.0
540 stars 128 forks source link

Clean up commands #1087

Closed CrispyDrone closed 3 years ago

CrispyDrone commented 3 years ago

🏗 Enhancement Proposal

Commands are an instruction to nukeeper. They should only concern themselves with the information that's required to invoke a useful action from nukeeper.

I propose:

Pitch

Right now it's really difficult to get a clear overview of which options are part of a particular command since you have to go through the inheritance hierarchy and look at all the properties.

For the same reason, it can also be difficult to see where exactly a new option belongs and the impact it has on all the derived commands.

A lot of different functionality has been added to these commands making it difficult to understand what is happening where, and to test these things in isolation.

Refactoring towards command -> command validator -> command handler will promote loose coupling and a consistent style. Currently you have to look at all the commands to see where the Execute method is actually overridden—sometimes in the the terminal class such as InspectCommand, but sometimes in a non-terminal class like CollaborationPlatformCommand. The same thing is true about the validation; you have to go through all the classes of the inheritance hierarchy to get a full picture of the validation, and there's no clear indication what one of these classes will be validating on.

Setting up this small pipeline will also make it trivial to extend it such as adding logging, performance measuring, exception handling,... For this you could use an existing librray such as MediatR or write your own ICommand and IRequest interfaces and let the IoC handle the decoration.

Platforms affected (mark all that apply)

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.