GitHub Code Quality - GitHub Docs
GitHub Code Quality
GitHub Code Quality catches quality issues before merge, delivers one-click Copilot-powered fixes inline, and checks your code coverage.
Who can use this feature?
GitHub Team or GitHub Enterprise Cloud
In this article
Up next
GitHub Code Quality billingGitHub Code Quality helps you keep your codebase healthy in two ways:
- Code Quality findings identify reliability and maintainability issues in your code, with Copilot-powered fixes you can apply in one click.
- Code coverage shows how much of your code your tests run, so you can find untested code and track whether coverage is improving over time.
Code Quality findings
Code Quality analyzes your code with deterministic CodeQL rules and AI-powered analysis. Findings appear in two places:
- On pull requests , CodeQL rules detect known anti-patterns and post findings as inline comments with one-click fixes, before code is merged. You can enforce quality thresholds with rulesets to block pull requests that don't meet your criteria, so new quality debt doesn't accumulate.
- On the default branch , rules-based scans identify existing quality debt across your codebase, with autofixes you can apply directly or assign to Copilot cloud agent to resolve on your behalf. AI-powered analysis also runs on recently changed files. It flags issues that fall outside existing rule sets, including in languages not yet covered by CodeQL queries. This helps you hold AI-generated code to the same bar as hand-written code.
Administrators can also review findings across repositories in security overview. They can see current quality posture across the organization, review how open findings have changed over time, and identify which repositories need attention. See Exploring GitHub Code Quality results in your organization .
Note
On pull requests, Code Quality posts rules-based CodeQL findings only. If you also want AI-powered reviews of your pull requests, you can enable GitHub Copilot code review separately. See GitHub Copilot code review .
Supported languages
Code Quality performs rule-based analysis of the following languages using CodeQL:
- C#
- Go
- Java
- JavaScript
- Python
- Ruby
- TypeScript
Code Quality also performs AI-powered analysis on your repository's recently changed code, including languages beyond those supported by rule-based queries.
Code coverage
Code coverage measures what percentage of your code runs when your tests run. Code that your tests never run can hide bugs that only appear in production.
Code Quality measures line coverage : the percentage of executable lines that at least one test runs.
How code coverage works
To provide coverage data, a workflow runs your tests and uploads a Cobertura XML coverage report to GitHub. You can set this up in two ways:
- Automatic setup: An AI-powered agent analyzes your repository and opens a pull request with a coverage workflow.
- Manual setup: You add steps to your own workflow that generate and upload the coverage report.
For instructions, see Setting up code coverage for your repository .
Where coverage results appear
After you set up code coverage, results appear in two places:
- On pull requests: A comment compares the pull request's line coverage with the default branch and breaks down the change for each file. You can enforce coverage thresholds with rulesets to block pull requests that reduce coverage.
- In the repository coverage overview (public preview): A dashboard shows total line coverage as a percentage for your default branch and how it compares with your coverage goal. A graph shows whether coverage has improved or regressed over the last 14, 30, or 90 days.
For details about how line coverage is calculated, see Code coverage reference .
Availability and billing
Usage costs for GitHub Code Quality are determined by:
- A per-seat license fee based on active committers.
- Copilot-powered autofixes for findings in pull requests and on the default branch, alongside AI-powered detections on recently merged code, which consume GitHub AI Credits (no Copilot license required).
- GitHub Actions minutes for deterministic CodeQL scans, if you don't use self-hosted runners.
Optional features, such as delegating code quality remediation work to Copilot, require a Copilot license.
For more information, see GitHub Code Quality billing .
Use cases
Here's what GitHub Code Quality looks like in practice.
For developers and teams:
- A developer opens a pull request that introduces a reliability or maintainability issue. Code Quality posts a comment explaining the issue and offers a one-click fix before the code is merged. The developer also sees a report of line coverage metrics, and can tell at a glance whether the pull request improves or reduces coverage compared to the default branch.
- A team inherits a large codebase with years of accumulated quality debt. Code Quality scans the default branch, surfaces findings with autofixes on a dashboard, and the team assigns remediation work to Copilot to open fix pull requests automatically.
- A team adopts AI coding assistants and needs assurance that generated code meets the same bar as hand-written code. AI-powered analysis catches issues in recently changed files that rule-based queries weren't written for, while CodeQL rules cover well-defined anti-patterns.
For administrators and leads:
- An engineering lead sets coverage and quality thresholds using rulesets. Pull requests that don't meet the criteria are blocked from merging, so no new quality or coverage debt accumulates.
- An administrator needs visibility across repositories for audits or compliance reporting. Code Quality reports through the security overview alongside security tools, so they can see current quality posture across the organization, review how open findings have changed over time, and identify which repositories need attention. See Exploring GitHub Code Quality results in your organization .
- A maintainer reports on code coverage . The repository coverage overview shows current coverage on the default branch and whether it has improved or regressed over the last 14, 30, or 90 days. See Viewing code coverage for your repository .
Next steps
- Learn how to fix code quality findings on your pull request. See Preventing code quality issues from reaching your default branch .