Refactored splicectl to make code drier, easier to maintain, and easier to extend with future features.
Most changes were focused on making small packages that focused on one common task and reducing global namespace pollution. This was achieved by:
New sub package for nearly all sub commands. Some sub commands were unlikely to be extended so putting them in their own package was unnecessary.
Reduced ~500 lines of duplicated code and placed shared functionality into a new package "config". All commands are given a config that is created by the top level command. This config contains most shared functionality that many commands need acces to.
Motivation and Context
This was done in anticipation of adding several new commands and sub commands which will now be easier to organize, discover preexisting functionality that already exists, and keeping the global namespace smaller so development is more focused.
No user facing changes have been made, but many maintenance focused improvements have been made.
I carried out regression testing manually, verifying that the tool still worked as expected and compared output to a pre-refactored version of the tool. I noticed no degradation of service, although I cannot be sure that I performed every possible combination of commands, so small bugs could have possibly made their way into the tool. I kept these changes in review for ~2 weeks and continued using the refactored version of splicectl during that time period and still have not found any errors.
Screenshots (if appropriate)
Checklist
If the pull request includes user-facing changes, extra documentation is required:
[ ] If the change is user facing, please ensure you add info in one of the Changelog Inclusions sections.
Changelog Inclusions
base feature note
BREAKING note on base feature
Basically whatever formatting we have here, just plain-text
%> command example
Description
Refactored splicectl to make code drier, easier to maintain, and easier to extend with future features.
Most changes were focused on making small packages that focused on one common task and reducing global namespace pollution. This was achieved by:
Motivation and Context
This was done in anticipation of adding several new commands and sub commands which will now be easier to organize, discover preexisting functionality that already exists, and keeping the global namespace smaller so development is more focused.
No user facing changes have been made, but many maintenance focused improvements have been made.
See DBAAS-5756
Dependencies
How Has This Been Tested?
I carried out regression testing manually, verifying that the tool still worked as expected and compared output to a pre-refactored version of the tool. I noticed no degradation of service, although I cannot be sure that I performed every possible combination of commands, so small bugs could have possibly made their way into the tool. I kept these changes in review for ~2 weeks and continued using the refactored version of splicectl during that time period and still have not found any errors.
Screenshots (if appropriate)
Checklist
If the pull request includes user-facing changes, extra documentation is required:
Changelog Inclusions
Additions
Changes
Fixes
Deprecated
Removed
Breaking Changes