Skip to content
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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Get analysis result out of tool.analyze() #273

wants to merge 13 commits into from

Conversation

goto-bus-stop
Copy link
Contributor

This way the main Clinic cli can print recommendations to the command line output, primarily for use in CI.

@AndreasMadsen
Copy link
Contributor

Some feedback if you don't mind.

  • "Doctor check" is cute, but I think you should choose a name that makes sense for the entire clinic suite. Maybe just analyze.

  • Include the raw data, for future projects we may wish to utilize that.

  • Consider excluding results.recommendation for now, it looks quite ad-hoc and I'm not sure it is required.

if (err) {
callback(err)
} else {
callback(null, result)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@goto-bus-stop goto-bus-stop changed the title Get analysis result out of tool.check() or tool.visualize() Get analysis result out of tool.analyze() or tool.visualize() Dec 3, 2019
@goto-bus-stop goto-bus-stop changed the title Get analysis result out of tool.analyze() or tool.visualize() Get analysis result out of tool.analyze() Dec 3, 2019
@goto-bus-stop goto-bus-stop marked this pull request as ready for review December 3, 2019 12:24
@jasnell jasnell changed the base branch from master to main August 21, 2020 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants