{"meta":{"title":"Code coverage reference","intro":"Code Quality shows what percentage of the lines of your code your tests actually exercise, so you can find untested code before you merge.","product":"Security and code quality","breadcrumbs":[{"href":"/en/code-security","title":"Security and code quality"},{"href":"/en/code-security/reference","title":"Reference"},{"href":"/en/code-security/reference/code-quality","title":"Code quality"},{"href":"/en/code-security/reference/code-quality/code-coverage","title":"Code coverage"}],"documentType":"article"},"body":"# Code coverage reference\n\nCode Quality shows what percentage of the lines of your code your tests actually exercise, so you can find untested code before you merge.\n\nCode coverage measures what percentage of the lines in your source code are executed when your test suite runs. Code Quality displays a line coverage percentage on pull requests after you upload a Cobertura XML coverage report.\n\n> \\[!NOTE]\n> Code Quality reports **line coverage** only. Coverage tools often also report function, branch, or statement coverage. Code Quality does not currently use these metrics, even if your Cobertura XML report includes them, and they are not shown on pull requests or evaluated by coverage threshold rules.\n\n## How line coverage is calculated\n\nThe line coverage percentage represents the number of lines covered by tests divided by the total number of lines, expressed as a percentage. Code Quality stores the latest upload for each branch (including the default branch) and compares the pull request branch line coverage to the default branch line coverage.\n\nFor example, if your default branch has 44% line coverage and your pull request branch has 65% line coverage, the pull request gained 21 percentage points of line coverage.\n\n## Per-file delta\n\nThe per-file breakdown on pull requests shows how line coverage changed for each modified file. A positive delta means the file gained line coverage on the pull request branch compared to the default branch.\n\nTo set up code coverage for your repository, see [Setting up code coverage for your repository](/en/code-security/how-tos/maintain-quality-code/set-up-code-coverage).\n\n## Further reading\n\n* [Metrics and scores reference](/en/code-security/reference/code-quality/metrics-and-ratings)"}