1
0
mirror of synced 2025-12-19 09:57:42 -05:00
Files
docs/content/code-security/code-quality/tutorials/improve-your-codebase.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

7.2 KiB

title, shortTitle, intro, versions, product, permissions, topics, contentType
title shortTitle intro versions product permissions topics contentType
Improving the quality of your repository's code Improve your codebase Learn how to assess and remediate code quality issues detected on your default branch so you can improve the quality of your codebase. As you progress, you'll see your repository's code quality rating rise as a result.
feature
code-quality
{% data reusables.gated-features.code-quality-availability %} {% data reusables.permissions.code-quality-see-repo-findings %}
Code Quality
tutorials

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

Introduction

This tutorial guides you through using {% data variables.product.prodname_code_quality %} to review, prioritize, and remediate code health issues across your repository — helping you systematically reduce technical debt, improve reliability and maintainability, and communicate your impact to stakeholders.

Prerequisites

  • {% data variables.product.prodname_code_quality_short %} is enabled for your repository. See AUTOTITLE.
  • A full scan of the default branch has completed.

1. Assess your repository's overall code health

  1. Navigate to the "Security" tab of your repository, then under "{% data variables.code-quality.code_quality_ui_views %}", click {% data variables.code-quality.all_findings %}.

  2. The overview on the "{% data variables.code-quality.all_findings %}" dashboard gives you an immediate assessment of the state of your default branch today:

    • Maintainability rating reflects the presence and severity of findings for dead code, duplication, complexity, missing documentation, and failure to follow best practices.
    • Reliability rating reflects the presence and severity of findings for correctness, performance, error handling, concurrency, and accessibility of your code.

    Screenshot of code quality ratings in the "{% data variables.code-quality.all_findings %}" view for {% data variables.product.prodname_code_quality_short %}.

2. Identify and prioritize the most impactful findings

On the "{% data variables.code-quality.all_findings %}" view, you'll see the list of results from {% data variables.product.prodname_code_quality_short %}'s last scan of the default branch of the repository. These findings are:

  • Grouped by rule, so you can see which types of problem most affect your codebase.
  • Assigned a severity level ("Error", "Warning", "Note").

Focus on high severity findings

Use the dashboard filters to focus on the highest-severity results first ("Errors"), and review which rules generate the most issues.

Screenshot showing the dashboard filters for the "{% data variables.code-quality.all_findings %}" view.

To improve your repository's maintainability or reliability rating, you must resolve (fix or dismiss) all findings with the highest severity level for that metric.

For example, to improve your repository's "Reliability" metric from Needs improvement to Fair, you would need to address and resolve all error-level findings that impact reliability. If you have one or more error-level findings, your rating cannot be higher than "Needs improvement". See AUTOTITLE.

3. Investigate a group of findings and understand context

Once you've identified a rule with multiple results that you want to address, you can investigate further to understand the underlying problems.

  1. Click the rule name to be taken to a detailed view of all findings for that rule.

    Screenshot showing a rule in the "{% data variables.code-quality.all_findings %}" view. The rule name is highlighted in dark orange.

  2. Click Show more, then review the explanation of the rule, what the recommended fix is, supporting code examples and references.

    Screenshot showing the results for a code quality rule. The text "Show more" is highlighted in dark orange.

4. Choose remediation options

Evaluate all the highlighted findings for validity, impact, and risk. To improve your quality rating, you need to resolve each finding by either choosing to fix or dismiss it.

Generate an autofix

If the finding looks valid and relevant for your codebase, you can generate a suggested fix.

  1. To the right of an individual finding, click {% octicon "copilot" aria-hidden="true" aria-label="copilot" %} Generate fix.

  2. Review carefully the diff of the proposed change, and if you agree with it, click Open pull request.

  3. In the "Commit autofix to branch" dialog box, select "Open a pull request", then click Commit change.

    Tip

    It's not currently possible to generate autofixes for a group of findings in bulk.

    If you want to address multiple findings with a single pull request, repeat steps 1 and 2 above, then in the "Commit autofix to branch" dialog box, use the branch name you already created for the first autofix, then select "Open pull request" and Commit change.

    The fix will be added to the existing draft pull request for your branch.

  4. When you're ready, change the pull request status from "Draft" to "Ready for review", and carefully review the proposed changes. Wait for any CI checks and automated tests to complete and pass before merging the pull request.

Dismiss a finding

{% data reusables.code-quality.dismiss-irrelevant-findings %}

  1. To dismiss a finding, click {% octicon "shield-slash" aria-label="Dismiss" %}.
  2. The finding will disappear from the list of open findings. You can still review and reopen dismissed findings from under the "Dismissed" tab at the top of the page.

5. Measure improvement and communicate impact

After remediation work is complete, return to the "{% data variables.code-quality.all_findings %}" dashboard to review the updated reliability and maintainability metrics.

When communicating your impact to stakeholders, highlight:

  • Any reduction in the number of findings for "Reliability" or "Maintainability".
  • Any change in rating for the Reliability or Maintainability ratings.
  • The requirement(s) that has been met to achieve the change in rating. For example, the remediation of all "Warning"-level findings caused the rating to change from "Fair" to "Good".

Use the improvements in quality ratings and reduction in number of findings to demonstrate progress.

6. Enforce code quality standards for pull requests

If you haven't already, set up quality thresholds for pull requests, to block any changes to the codebase that will reduce the health of your codebase. See AUTOTITLE.

Next steps

  • Reduce technical debt further by fixing findings in recently changed files. See AUTOTITLE.
  • Provide feedback on {% data variables.product.prodname_code_quality %} in the community discussion.