0

I am trying to do some code coverage analysis, and we enabled codecov on our opensource projec. but I can get the following information:

  1. patch % of a PR
  2. the response json explaination anyone could help on this? thanks a lot in advanced https://docs.codecov.com/reference/repos_report_retrieve

1 Answers1

0

Tom from Codecov here. So, patch coverage inherently is between two commits. You can use the comparison endpoint to get patch data.

As an example, this is the URL (https://api.codecov.io/api/v2/github/codecov/repos/example-python/compare/?pullid=114) for pull request 114 on the repo codecov/example-python. Note that you may need an API key.

The response generated includes

    "totals": {
        "patch": {
            "files": 1,
            "lines": 1,
            "hits": 1,
            "misses": 0,
            "partials": 0,
            "coverage": 100.0,
            "branches": 0,
            "methods": 0,
            "messages": 0,
            "sessions": 0,
            "complexity": 0.0,
            "complexity_total": 0.0,
            "complexity_ratio": 0,
            "diff": 0
        }
    },

You are looking for totals.patch.coverage (100.0) which matches what is shown in Codecov.

Thomas Hu
  • 141
  • 5