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

Batch reporter output for slice of primitives #208

Merged
merged 1 commit into from
Jun 10, 2020
Merged

Batch reporter output for slice of primitives #208

merged 1 commit into from
Jun 10, 2020

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Jun 9, 2020

Rather than having a single element on each line,
which becomes unreadable. Batch multiple elements for slices
of primitives to be on a single line.

Fixes #170

line, isLine := r.Value.(textLine)
if r.Diff == 0 && r.Key == "" && isLine && r.Comment == nil {
isPrimitive = true
totalLength += len(line)

Choose a reason for hiding this comment

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

Where do you use totalLength after?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, good catch. Removed.

Comment on lines 254 to 255
if r.Diff == 0 && r.Key == "" && isLine && r.Comment == nil {
isPrimitive = true

Choose a reason for hiding this comment

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

Optional.

isPrimitive = r.Diff == 0 && r.Key == "" && isLine && r.Comment == nil
if !isPrimitive {
    break
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice, I like it.

Rather than having a single element on each line,
which hurts readability due to the need for scrolling quite a bit.
Batch multiple elements for simple lists to be on a single line.

Fixes #170
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.

Reporter should gracefully handle long slices
2 participants