Codecov

Code coverage done right.®

Welcome to Codecov Documentation. You'll find comprehensive guides and documentation to help you start working with Codecov as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

codecov.yml Reference

Top-level sections used in codecov.yml

codecov

codecov:
  token: "<some token here>"
  bot: "codecov-io"
  ci:
    - "travis.org"
  strict_yaml_branch: "yaml-config"
  max_report_age: 24
  disable_default_path_fixes: no
  require_ci_to_pass: yes
  notify:
    after_n_builds: 2
    wait_for_ci: yes

codecov.token

The repository upload token

  • Type: String
  • Default: N/A

codecov.bot

The username you want to use for Codecov operations


codecov.ci

Additional CI provider URLs you want Codecov to recognize.


codecov.strict_yaml_branch

Specify a branch you want Codecov to always only read the YAML from


codecov.max_report_age

The age you want coverage reports to expire at, or if you want to disable this check. Expired reports will not be processed by codecov.


codecov.disable_default_path_fixes

Should Codecov's default path fixes be disabled


codecov.require_ci_to_pass

Should Codecov wait for all other statuses to pass before sending its status.

  • Type: Boolean
  • Default: yes

codecov.notify

codecov.notify.after_n_builds

How many uploaded reports Codecov should wait to receive before sending statuses


codecov.notify.wait_for_ci

Should Codecov wait for all CI statuses to complete before sending ours.
Note: Codecov considers all non-codecov statuses to be CI statuses

  • Type: Boolean
  • Default: yes

coverage

coverage:
  precision: 2
  round: down
  range: "70...100"
  notify:
    # notification blocks. See: https://docs.codecov.io/docs/codecovyml-reference#section-coverage-notify
  status:
    project:
    patch:
    changes:

coverage.precision

What precision do you want the coverage value to be

  • Type: Range(0,5)
  • Default: 2

coverage.round

Which direction to you want to round the coverage value

  • Type: One of 'down', 'up', 'nearest'
  • Default: down

coverage.range

The value range where you want the value to be green


coverage.notify

The standard notification settings are shown below, but it is recommend to view https://docs.codecov.io/docs/notifications for more information.

<notification_provider>: #see: ttps://docs.codecov.io/docs/notifications
  url: "https://hooks.example.com/hook/8675309"
  branches': 
    - master
    - dev
    - staging
  threshold': 1%
  flags: 
    - backend
    - frontend
  base: "parent"
  only_pulls: false
  paths: "*/**/*"

Note that the following notification providers are supported and will need to be defined in the YAML (see Notifications):

  • Gitter
  • Hipchat
  • IRC
  • Slack

coverage.status

See: https://docs.codecov.io/docs/commit-status for more information

coverage:
  status:
    project:
      default: # This can be anything, but it needs to exist as the name
        # basic settings
        target: auto
        threshold: 5%
        base: auto 
        # advanced settings
        branches: 
          - master
        if_ci_failed: error #success, failure, error, ignore
        only_pulls: false
        flags: 
          - frontend
        paths: 
          - src/frontend

parsers

parsers:
  javascript:
    enable_partials: yes
  v1:
    include_full_missed_files: true  # default false
 gcov:
    branch_detection:
      conditional: yes
      loop: yes
      method: no
      macro: no

parsers.javascript

Unknown


parsers.v1

Unknown


parsers.gcov

Controls how Codecov parses branch coverage in gcov reports. The coverage much exist in the uploaded report for us to parse it.

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

ignore

ignore:
  - "path/to/folder"  # ignore folders and all its contents
  - "test_*.rb"       # wildcards accepted
  - "**/*.py"         # glob accepted

fixes

fixes:
  - "before/::after/"  # move path   e.g., "before/path" => "after/path"
  - "::after/"         # move root   e.g., "path/" => "after/path/"
  - "before/::"        # reduce root e.g., "before/path/" => "path/"

flags

flags:
  projectA:  
    paths:
      - projectA/src
     carryforward: false #default -- false
  projectB:
    paths:
      - projectB/src
     carryforward: true

comment

comment:
  layout: "reach, diff, flags, files"
  behavior: default
  require_changes: false  # if true: only post the comment if coverage changes
  require_base: no        # [yes :: must have a base report to post]
  require_head: yes       # [yes :: must have a head report to post]
  branches:               # branch names that can post comment
    - staging
    - master
  after_n_builds: <number> #e.g., 5. The number of uploaded reports codecov

github_checks (GitHub users only)

github_checks:
  annotations: false

annotations

Specify whether to use GitHub Checks annotations or normal statuses. GitHub Checks are enabled by default on the patch status

Updated 10 days ago


codecov.yml Reference


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.