-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌱 Logic extraction refactor #414
Conversation
Signed-off-by: Alejandro Brugarolas <[email protected]>
Signed-off-by: Alejandro Brugarolas <[email protected]>
Signed-off-by: Alejandro Brugarolas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. I think patterns are starting to emerge from the "god object" file that is analyze.go
, and we are on the right direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks really good! My one ask is possibly renaming the CommandContext
struct to something more analyzer-specific, e.g. AnalyzeCommandContext
. That way, we can use the same logic across other subcommands if necessary. As of now, the only other subcmd is transform, but we are planning to add additional subcommand(s) for the asset generation work. I think this will help keep it more flexible.
Signed-off-by: Alejandro Brugarolas <[email protected]>
Signed-off-by: Alejandro Brugarolas <[email protected]>
Signed-off-by: Alejandro Brugarolas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thank you!
This PR is an initial refactor and a continuation of the discussion in PR #372 and Issue #249 .
In this PR, I separate the properties of the
analyzeCommand
that are not arguments of the command itself and move them to another struct calledCommandContext
, also extracting the functions that do not use properties fromanalyzeCommand
but do rely onCommandContext
.Additionally, I moved some functions that are not specific to
analyzeCommand
orCommandContext
to the "utils" module.For the next PR, the plan is to extract the logging functionality into a separate struct within its own package. This will allow it to be instantiated as a singleton, enabling decoupling of the logging logic from the rest of the code. Alongside this, I will also separate the constants currently defined at the beginning of analyze so that later, the providers can be moved to their own package.