-
Notifications
You must be signed in to change notification settings - Fork 50
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
Get analysis result out of tool.analyze()
#273
base: main
Are you sure you want to change the base?
Conversation
Some feedback if you don't mind.
|
if (err) { | ||
callback(err) | ||
} else { | ||
callback(null, result) |
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.
Having visualize
output a structured object is a bit odd. If anything, it should output the file stream. A better separation of logic would be collect() -> analyze() -> visualize()
. Where visualize()
takes the analyze()
output. I do see the incompatibility, but maybe analyze()
should output streams?
I don't have any strong opinions. A valid alternative is also to just force the API consumer to call both methods if they want both a structured object and a file.
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.
Yeah, I think analyze()
→ visualize()
would be ideal, but I didn't wanna break the API 😛 I did it this way so the CLI could avoid running the analysis twice. I agree with your points tho.
tool.check()
or tool.visualize()
tool.analyze()
or tool.visualize()
tool.analyze()
or tool.visualize()
tool.analyze()
This way the main Clinic cli can print recommendations to the command line output, primarily for use in CI.