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

cmd/cover: add number of uncovered lines #31519

Open
rabadin opened this issue Apr 17, 2019 · 8 comments

Comments

@rabadin
Copy link

commented Apr 17, 2019

The coverage HTML file generated by go tool cover -html=coverage.out only displays the coverage percentage per package; as a result it's hard to identify, by just glancing at the list of packages and their coverage, where the coverage is lacking because small packages and giant packages are treated the same.
This is a feature request to add, in addition to the coverage percentage, the number of lines that are uncovered: this will enable to see what packages are big contributors to the lack of coverage.

@gopherbot

This comment has been minimized.

Copy link

commented Apr 17, 2019

Change https://golang.org/cl/172424 mentions this issue: cmd/cover: add feature to sort packages in coverage HTML file

@robpike

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

There are external tools such as IDEs that read this file format, so this would be a breaking change to them. Regardless of its own merits, a change like this needs to be rolled out carefully.

@agnivade agnivade added this to the Unplanned milestone Apr 18, 2019

@rabadin

This comment has been minimized.

Copy link
Author

commented Apr 18, 2019

Thanks for the reply @robpike! Note that I'm not talking about changing the format of the coverage itself, only that of the HTML file produced by go tool cover -html=coverage.out. Is this HTML file read by IDEs?
In the comment to the related change (https://go-review.googlesource.com/c/go/+/172424/) I have an example of the "improved" HTML.

@robpike

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2019

Ah, I misunderstood. I don't know if IDEs read the HTML, but I doubt it.

@rabadin

This comment has been minimized.

Copy link
Author

commented Apr 18, 2019

Ah, I misunderstood. I don't know if IDEs read the HTML, but I doubt it.

Same here, I believe it's reasonably safe to change the HTML.

@bcmills

This comment has been minimized.

Copy link
Member

commented May 28, 2019

@ianthehat

This comment has been minimized.

Copy link

commented May 28, 2019

I would be very surprised if any tool/integration is attempting to parse the HTML (I don't know of one), and I don't think it would be sensible to refuse changes if that was the only reason. The HTML output should never be a stable supported API!

@rabadin

This comment has been minimized.

Copy link
Author

commented May 28, 2019

@ianthehat Totally agree... I think the only "interface" the HTML should fulfill is to be valid HTML ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.