1
0
mirror of synced 2025-12-19 09:57:42 -05:00
Files
docs/content/code-security/code-quality/tutorials/improve-recent-merges.md
Sophie c1ca049106 October 28-29: GitHub Universe 2025 docs-internal megabranch (#57869)
Signed-off-by: Meredith Lancaster <malancas@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Anne-Marie <102995847+am-stead@users.noreply.github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Laura Coursen <lecoursen@github.com>
Co-authored-by: AlonaHlobina <54394529+AlonaHlobina@users.noreply.github.com>
Co-authored-by: Isaac Brown <101839405+isaacmbrown@users.noreply.github.com>
Co-authored-by: Jules <19994093+jules-p@users.noreply.github.com>
Co-authored-by: Siara <108543037+SiaraMist@users.noreply.github.com>
Co-authored-by: Kelly Arwine <kellyarwine@github.com>
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
Co-authored-by: Jon Janego <jonjanego@github.com>
Co-authored-by: Jules Porter <jules-p@users.noreply.github.com>
Co-authored-by: hubwriter <hubwriter@github.com>
Co-authored-by: Laurenzo <lsto@github.com>
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
Co-authored-by: Vanessa <vgrl@github.com>
Co-authored-by: Melanie Yarbrough <11952755+myarb@users.noreply.github.com>
Co-authored-by: Claire W <78226508+crwaters16@users.noreply.github.com>
Co-authored-by: Felix Guntrip <guntrip@github.com>
Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>
Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com>
Co-authored-by: Tim Rogers <timrogers@github.com>
Co-authored-by: docs-bot <77750099+docs-bot@users.noreply.github.com>
Co-authored-by: Guillaume Perrot <guperrot@github.com>
Co-authored-by: Mark Tareshawty <tarebyte@github.com>
Co-authored-by: Hirsch Singhal <1666363+hpsin@users.noreply.github.com>
Co-authored-by: Emily Gould <4822039+emilyistoofunky@users.noreply.github.com>
Co-authored-by: Sunbrye Ly <56200261+sunbrye@users.noreply.github.com>
Co-authored-by: PJ Quirk <pjquirk@github.com>
Co-authored-by: Steve Ward <steveward@github.com>
Co-authored-by: Sarita Iyer <66540150+saritai@users.noreply.github.com>
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
Co-authored-by: SiaraMist <siaramist@github.com>
Co-authored-by: Tomoko Tanaka <28242405+tallzeebaa@users.noreply.github.com>
Co-authored-by: a1exmozz <187176404+a1exmozz@users.noreply.github.com>
Co-authored-by: Meredith Lancaster <malancas@users.noreply.github.com>
Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com>
Co-authored-by: Andy Barnes <kurgol@github.com>
Co-authored-by: Sheena Ganju <sheenyg@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sydney Wilson <86739163+swilson15@users.noreply.github.com>
Co-authored-by: Robert Sese <734194+rsese@users.noreply.github.com>
Co-authored-by: Vimala Moger <166641453+VimalaMoger@users.noreply.github.com>
Co-authored-by: Sharra-writes <sharra-writes@github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jenni C <97056108+dihydroJenoxide@users.noreply.github.com>
Co-authored-by: Greg Mondello <72952982+gmondello@users.noreply.github.com>
Co-authored-by: Mia Arts <107727642+its-mia@users.noreply.github.com>
Co-authored-by: sunbrye <sunbrye@github.com>
Co-authored-by: Lorenz Vanthillo <lorenz.vanthillo@gmail.com>
Co-authored-by: Eboni <32157169+EboniLM@users.noreply.github.com>
Co-authored-by: Junko Suzuki <pnsk@github.com>
Co-authored-by: Alex Nguyen <150945400+nguyenalex836@users.noreply.github.com>
Co-authored-by: heiskr <1221423+heiskr@users.noreply.github.com>
Co-authored-by: Patrick Knight <patrick-knight@github.com>
Co-authored-by: T. Greg Doucette <58960990+LawDevNull@users.noreply.github.com>
Co-authored-by: Evan Bonsignori <ebonsignori@github.com>
Co-authored-by: Robert Justin Monzingo <robertjmonzingo@gmail.com>
Co-authored-by: John Coleman <thenewcoke@gmail.com>
Co-authored-by: Brendan Scott-Smith <117171930+bss-mc@users.noreply.github.com>
Co-authored-by: Chad Bentz <1760475+felickz@users.noreply.github.com>
Co-authored-by: Justin Alex <1155821+jusuchin85@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: azenMatt <7584089+azenMatt@users.noreply.github.com>
Co-authored-by: Felix Guntrip <stevecat@github.com>
Co-authored-by: timrogers <116134+timrogers@users.noreply.github.com>
Co-authored-by: John Clement <70238417+jclement136@users.noreply.github.com>
Co-authored-by: vaindil <vaindil@github.com>
Co-authored-by: Matthew Isabel <matthewisabel@github.com>
Co-authored-by: Matthew Isabel <matthew.isabel@gmail.com>
2025-10-28 15:40:35 +00:00

8.3 KiB

title, shortTitle, intro, versions, product, permissions, topics, contentType, redirect_from
title shortTitle intro versions product permissions topics contentType redirect_from
Improving the quality of recently merged code with AI Improve recent merges Learn how to assess and remediate issues detected by {% data variables.product.prodname_code_quality %} in your most recently changed code, so you can maintain high standards of code health across your default branch.
feature
code-quality
{% data reusables.gated-features.code-quality-availability %} {% data reusables.permissions.code-quality-see-repo-findings %}
Code Quality
other
/code-security/code-quality/tutorials/improve-active-code

{% data reusables.code-quality.code-quality-preview-note %}

Introduction

This tutorial shows you how to explore and remediate quality issues that have been detected by {% data variables.product.prodname_code_quality_short %}'s analysis of code that was recently merged into your default branch.

When you improve quality of recently merged files, you reduce technical debt in the repository and make it easier for other developers to work on files that are under active development.

{% data variables.product.prodname_code_quality_short %} has two lines of defense

{% data variables.product.prodname_code_quality_short %} scans pull requests and comments on quality concerns, then runs a second AI scan after the pull request is merged. The two types of scan use complementary technologies:

  • Pull request scans use {% data variables.product.prodname_codeql %} rules to identify problems. This analysis is thoroughly tested, good at identifying where code doesn't match the quality rules, and can analyze many files. However, it supports a subset of coding languages and cannot identify problems where there is no rule.

  • Recently merged file scans use a large language model to analyze your most recently changed files and report findings for up to {% data variables.code-quality.num_ai_findings %} files. This analysis examines your code across all languages, without being limited by rules, and provides contextual insights and suggestions that can go beyond what {% data variables.product.prodname_codeql %} rules offer.

Prerequisites

  • {% data variables.product.prodname_code_quality_short %} is enabled, see AUTOTITLE.
  • At least one pull request has been merged since {% data variables.product.prodname_code_quality_short %} was enabled.

1. View the AI suggestions for your repository

After a {% data variables.product.prodname_code_quality_short %} scan of the recently merged files on your default branch, you can see the results under the {% data variables.code-quality.recent_suggestions %} view, which displays findings for up to {% data variables.code-quality.num_ai_findings %} files.

{% data reusables.code-quality.dashboard-navigation-repo %} {% data reusables.code-quality.dashboard-recent-suggestions %}

Note

This view is empty if the repository is inactive or if LLM analysis could not suggest ways to improve code quality in recent pushes to the default branch.

2. Explore suggested improvements for your repository

On the {% data variables.code-quality.recent_suggestions %} page, each file is listed with the number of quality problems identified and when the file was pushed to the default branch.

  • Click a file name to view details of the quality problems detected and the suggested fixes.

Screenshot of the "{% data variables.code-quality.recent_suggestions %}" view for code quality.

3. Delegate remediation work or open pull requests yourself

You can open a pull request to apply the suggested autofixes to a file or delegate the remediation work to {% data variables.copilot.copilot_coding_agent %}. You need a {% data variables.product.prodname_copilot_short %} license to assign work to {% data variables.copilot.copilot_coding_agent %}.
Sign up for {% data variables.product.prodname_copilot_short %} {% octicon "link-external" height:16 aria-label="link-external" %}

Delegate work to {% data variables.copilot.copilot_coding_agent %}

You can ask {% data variables.copilot.copilot_coding_agent_short %} to open pull requests to make improvements to files using the suggested changes as a prompt. This is the best option if the suggested changes look good to you and you want to open a pull request that applies fixes to more than one file.

To delegate pull request creation:

  • Multiple files: Select the files you want to include, then click Assign selected to {% data variables.product.prodname_copilot_short %} in the header for the list of files.
  • One file: Click Assign to {% data variables.product.prodname_copilot_short %} for the file.

There is a delay while the {% data variables.copilot.copilot_coding_agent_short %} sets up the work. When the pull request is open and work is in progress, a banner is displayed with a link to the pull request.

You can track {% data variables.copilot.copilot_coding_agent %}'s work:

  • In the pull request, the summary is updated as work progresses.
  • Using the agents page or session logs. See AUTOTITLE.

Open your own pull requests

You can open pull requests yourself to apply autofix suggestions. This is the best option if:

  • You want to work on the changes locally or in {% data variables.product.prodname_desktop %} before opening a pull request
  • You do not have access to {% data variables.copilot.copilot_coding_agent %}

Note

When you open a pull request yourself, you can only commit fixes to one file at a time. To fix multiple files at once, you must use {% data variables.copilot.copilot_coding_agent %}.

Opening a pull request

  1. Click the file name to view details of the quality problems detected.

  2. Review the problems and suggested fixes.

  3. Expand the Assign to {% data variables.product.prodname_copilot_short %} drop-down and then click {% octicon "git-pull-request" aria-hidden="true" aria-label="Pull request" %} Open pull request to change the default option to "Open pull request". Your preference is remembered.

    Screenshot of the "{% data variables.code-quality.recent_suggestions %}" view for code quality.

  4. Click Open pull request to open a dialog of commit options.

  5. Click Commit change to create a pull request with the fixes.

4. Provide pull request reviewers with context

Providing context on why you are proposing changes to code is the best way to encourage team members to review your pull request. If you used {% data variables.copilot.copilot_coding_agent %}, the pull request summary already includes full details of the problems fixed by the pull request.

If you opened the pull request directly from the {% data variables.product.prodname_code_quality %} view, the pull request summary links to the "{% data variables.code-quality.recent_suggestions %}" view. You may want to copy some of the explanations from the {% data variables.code-quality.recent_suggestions %} view into the pull request summary.

Screenshot of a pull request summary created by {% data variables.product.prodname_code_quality %}.

5. See your changes make an impact on {% data variables.code-quality.recent_suggestions %}

When you return to the "{% data variables.code-quality.recent_suggestions %}" view after merging your pull request, the findings you fixed are no longer listed.

Next steps

  • Learn more about how {% data variables.copilot.copilot_coding_agent %} can help expedite development tasks. See AUTOTITLE.
  • Provide feedback on {% data variables.product.prodname_code_quality %} in the community discussion.