8000 Percentage values in json-summary report · Issue #517 · gcovr/gcovr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Percentage values in json-summary report #517

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 occ 8000 asionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anotherandi opened this issue Sep 28, 2021 · 4 comments · Fixed by #570
Closed

Percentage values in json-summary report #517

anotherandi opened this issue Sep 28, 2021 · 4 comments · Fixed by #570

Comments

@anotherandi
Copy link

Describe the bug
In the json-summary report, the file-summary uses ratios in the attributes 'line_percent' and 'branch_percent'.
The value for full coverage is 1.0

To Reproduce
Steps to reproduce the behavior:

  1. Generate a coverage report using the --json-summary-pretty reporter with any coverages.

Expected behavior
The value for full coverage should be 100.0 (i.e. a percentage value)

Example output
{ "branch_covered": 2, "branch_percent": 100.0, "branch_total": 2, "files": [ { "branch_covered": 2, "branch_percent": 1.0, "branch_total": 2, "filename": "impl/my_library/src/my_base_class.cpp", "line_covered": 6, "line_percent": 1.0, "line_total": 6 } ], "gcovr/summary_format_version": "0.2", "line_covered": 6, "line_percent": 100.0, "line_total": 6, "root": "../../../../test" }

@anotherandi anotherandi changed the title Percenta values in json-summary report Percentage values in json-summary report Sep 28, 2021
@anotherandi
Copy link
Author

First analysis:

  • function_total, function_covered, function_percent) = summarize_file_coverage(covdata[key],
    uses summarize_file_coverage
  • summarize_file_coverage uses fixup_percent (to get ratio values [0...1.0] instead of percentage which was only intended for csv files

@latk
Copy link
Member
latk commented Sep 28, 2021

Yes, the summary report is inconsistent. I'm not entirely convinced whether [0,100] or [0,1] would be appropriate ranges in this context, but since it's a percentage I would expect the [0,100] range as well. Since the JSON formats are versioned, this can technically be changed without breaking backwards compatibility.

I have a branch somewhere that makes the coverage calculation clearer and would completely prevent such issues from reoccurring in the future. Then, fixing this issue would be a 1-line change. I'll open a PR once #515 is merged.

@Spacetown
Copy link
Member

I've in mind that there was a discussion if 0.0 to 100 or 0.0 or 1.0 is correct. After searching I found this:

@Spacetown
Copy link
Member

I was to slow.
@latk If you approve I can close #515.

Sign up for free to join this conversation on GitHub. Already have an account? Sig 4A78 n in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0