Closed xhd2015 closed 1 month ago
Chances are, maybe xgo can opt in into this tool?
sure, what are the requirements?
sure, what are the requirements?
When working a large code base, reviewing coverage of each file sucks as there were too many files.
Incremental coverage is a way to improve this experience. It filters out files not changed compared with master or main, which can be achieved by doing a git diff. And more, it should also filter out lines not changed within updated file.
This way, only changed code need a care on coverage.
How do you think?
Understood, let me think about how to do it. see https://github.com/gha-common/go-beautiful-html-coverage/issues/15
@xhd2015 can you open a pr here to create cover.out
with your tool here? I want to see what it looks like.
edit --
doesn't look like your tool does the incremental part, is the .out file generated by go tool?
@xhd2015 can you open a pr here to create
cover.out
with your tool here? I want to see what it looks like.edit --
doesn't look like your tool does the incremental part, is the .out file generated by go tool?
Sure, let me do this later.
Actually it does, but that part of code is still being open-sourcing. So now only binary is released.But soon the code will be opened.
would simply diffing main.out and current.out work?
would simply diffing main.out and current.out work?
Maybe. I can try that
can you open a pr here to create cover.out with your tool here? I want to see what it looks like.
@kilianc I think I misunderstood you. The xgo tool does not generate a cover profile. Actually it converts that profile into a web-based UI in combination with git diff, hence the so called incremental.
I think that diffing the cover.out
and then creating the html will work. I am a bit sick but I will be able to write some tests in the next few days.
making some progress on having dark and light themes from github and refining the UI.
I don't think it will be as feature rich as the one you posted tho.
making some progress on having dark and light themes from github and refining the UI.
![]()
I don't think it will be as feature rich as the one you posted tho.
Amazing! At least this is the first step to make it work!
Just merged into main, I need to add a "incremental button" to the UI and then I'll focus on the CLI.
@xhd2015 how do you get information about your base branch in your tooling? For example in feature-a
branch, how do you compare it main
? do you checkout main
and run the tests? Is the coverage saved somewhere?
If this was a cli, like go run go-beautiful-html-coverage
what would be the arguments?
Just merged into main, I need to add a "incremental button" to the UI and then I'll focus on the CLI.
@xhd2015 how do you get information about your base branch in your tooling? For example in
feature-a
branch, how do you compare itmain
? do you checkoutmain
and run the tests? Is the coverage saved somewhere?If this was a cli, like
go run go-beautiful-html-coverage
what would be the arguments?
This part of diffing is not open sourced yet, I'll work on this later.
Basically it just uses the exec.Command
to spawn some git diff
process and capture the output.
but that's not enough to diff the coverage, a change on foo.go#13
might affect coverage of func Bar
in bar.go#56
. The diff won't help you understand the impact of your code changes on coverage.
You need a full coverage diff against the base branch of your PR. When running locally, where do you get the coverage from? run the tests on main
and cache them?
Oh so you are right, I missed the affect-chain problems... Currently only static diff is considered
closing this for now
Xgo is working on a similar tool, the UI is still under refactoring. And I see this repository is doing this.
Are you going to support incremental coverage and CLI tool to display locally?
https://github.com/xhd2015/xgo/pull/106