Skip to content

Issue 79: Add a json reporter to quantify the extend of the cli's documenation #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

Merged
merged 5 commits into from
Oct 23, 2018

Conversation

sourishkrout
Copy link
Contributor

Description

Implemented a simple word/line counter report based on the HTML page generation written to the output ./html directory.

https://github.com/smallstep/ca-component/issues/79

@sourishkrout sourishkrout requested a review from maraino October 19, 2018 21:36
Copy link
Collaborator

@maraino maraino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would make sense to add an extra flag to generate the report.

return &report
}

func (report *Report) Write(w io.Writer) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linters will fail on public methods without docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, weird. My linter must have overlooked it for unknown reasons. I will get that fixed.

usage/html.go Outdated

// report
repjson := path.Join(dir, "report.json")
rjw, err := os.Create(repjson)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will override a previous report. If you think this can be an issue you can use utils.WriteFile() that will ask the user for consent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I think I will stick with what's there now. The default behavior of the HTML help is to overwrite existing files.

usage/help.go Outdated
cli.StringFlag{
Name: "report",
Usage: "The report <directory> for JSON report based on HTML docs.",
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way that the code works, looks like this should be a cli.BoolFlag instead of a string with the directory, with this, we will generate the report with step help --html <directory> --report

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. That works for me too. I'll make the changes.

Copy link
Collaborator

@maraino maraino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@maraino maraino merged commit edd1eae into master Oct 23, 2018
@maraino maraino deleted the sebastian/issue-79 branch October 23, 2018 01:54
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.

2 participants