# Missing documentation for C++ branch coverage

**URL:** <https://community.codecov.com/t/missing-documentation-for-c-branch-coverage/898>\
**Category:** Support\
**Tags:** cpp\
**Created:** [January 16, 2020, 8:18am UTC](https://community.codecov.com/t/missing-documentation-for-c-branch-coverage/898 "2020-01-16T08:18:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexjurkiewicz](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/alexjurkiewicz/32/472_2.png) [@alexjurkiewicz](https://community.codecov.com/u/alexjurkiewicz)\
**Post date:** [January 16, 2020, 8:18am UTC](https://community.codecov.com/t/missing-documentation-for-c-branch-coverage/898/1 "2020-01-16T08:18:14Z")

</div>

### Description

I am testing Codecov with a C++ project, and looking for help configuring branch coverage support.

The default `codecov.yml` includes this config:

```yaml
parsers:
  gcov:
    branch_detection:
      conditional: yes
      loop: yes
      method: no
      macro: no

```

However I can’t find the documentation for this section of the config. I’m building gcov coverage but don’t see to be getting branch coverage.

### Repository

> <https://github.com/alexjurkiewicz/crawl-ref/pull/5>

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [January 16, 2020, 4:18pm UTC](https://community.codecov.com/t/missing-documentation-for-c-branch-coverage/898/2 "2020-01-16T16:18:47Z")

</div>

Hi @alexjurkiewicz

[s]Looking at the reference, It looks like I didn’t either: [codecov.yml Reference](https://docs.codecov.io/docs/codecovyml-reference#section-parsers-gcov%5B/s%5D)

Edit: I’ve updated the docs slightly, it’s pretty confusing logic internally, so not sure how much better I can make them. Still thinking.

Generating branch coverage is going to be a function of the gcov reporter though, that part of the config tells us how to read it.

While I dig into those settings, can you share a commit SHA so I can pull the raw report and see if it contains branch coverage at the time of upload?

---

<div class="post-metadata">

**Author:** ![alexjurkiewicz](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/alexjurkiewicz/32/472_2.png) [@alexjurkiewicz](https://community.codecov.com/u/alexjurkiewicz)\
**Post date:** [January 16, 2020, 10:40pm UTC](https://community.codecov.com/t/missing-documentation-for-c-branch-coverage/898/3 "2020-01-16T22:40:55Z")

</div>

Thanks for the update. I can’t see your updated docs, are they live yet?

I’ve managed to solved my issue. The coverage I was generating didn’t include branch coverage. I just assumed it did.

Here’s a report with branch coverage enabled:

> **[Code coverage done right.](https://app.codecov.io/gh/alexjurkiewicz/crawl-ref/compare/5?src=pr&el=h1)**
>
> Hosted coverage report highly integrated with GitHub, Bitbucket and GitLab. Awesome pull request comments to enhance your QA.

The secret is to explicitly generate branch coverage. Here’s the magic option for `lcov`:

```auto
lcov --capture --rc lcov_branch_coverage=1 [...]

```

(If you use `gcov`, it should be possible to use the `-b` option to generate branch data – but I didn’t test if Codecov parses branch data in gcov format.)

So some feedback:

1. None of the C++ examples show branch coverage enabled, eg `gcov` with `-b`. That would be a good hint for future spelunkers.
2. It’s not clear in Codecov’s UI what sort of data was contained in your uploaded report. If Codecov had some UI which said “we accepted your report, which had line coverage YES branch coverage NO”.

I still have one issue, which is that Codecov doesn’t highlight which branches were taken (or not) in the UI. The line is marked as “partially covered” and it’s left to the reader to determine which branches need coverage. It’s possible to derive this information from gcov/lcov, for example `gcovr` tool can do it locally (see the second screenshot in [this section of its docs](https://gcovr.com/en/stable/guide.html#html-output)). That’s my feature request 😊

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [January 17, 2020, 1:57pm UTC](https://community.codecov.com/t/missing-documentation-for-c-branch-coverage/898/4 "2020-01-17T13:57:10Z")

</div>

The docs didn’t change much, it’s the [codecov.yml Reference](https://docs.codecov.io/docs/codecovyml-reference#section-parsers-gcov) section.

This is great feedback, and I’ve shared it with our product team. I’m glad you got it sorted!
