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>
90 lines
5.3 KiB
Markdown
90 lines
5.3 KiB
Markdown
---
|
||
title: Quickstart for GitHub Code Quality
|
||
intro: 'Review code quality findings, generate a {% data variables.copilot.copilot_autofix_short %}, and merge a pull request to improve reliability and maintainability with {% data variables.product.prodname_code_quality %}.'
|
||
allowTitleToDifferFromFilename: true
|
||
versions:
|
||
feature: code-quality
|
||
shortTitle: Quickstart
|
||
product: '{% data reusables.gated-features.code-quality-availability %}'
|
||
permissions: '{% data reusables.permissions.code-quality-see-repo-findings %}'
|
||
topics:
|
||
- Code Quality
|
||
contentType: get-started
|
||
---
|
||
|
||
## Introduction
|
||
|
||
{% data variables.product.prodname_code_quality %} ({% data variables.release-phases.public_preview %}) helps keep your code reliable and maintainable by surfacing code quality findings in pull requests and on your default branch.
|
||
|
||
In this tutorial, you’ll learn how to identify and fix a code quality finding on your default branch, helping to improve your repository’s code health.
|
||
|
||
### Prerequisites
|
||
|
||
* {% data variables.product.prodname_code_quality %} must be enabled for your repository and you must have code in a supported language. See [AUTOTITLE](/code-security/code-quality/how-tos/enable-code-quality).
|
||
* If you're enabling {% data variables.product.prodname_code_quality %} for the first time, ensure you've waited a few minutes after enablement for a scan of the default branch to complete.
|
||
|
||
## Review scan results for your default branch
|
||
|
||
In your repository, go to the **Security** tab, click **{% data variables.code-quality.code_quality_ui_views %}** in the left sidebar, then click **{% data variables.code-quality.all_findings %}** to open the repository dashboard.
|
||
|
||
Here you'll see:
|
||
|
||
* Ratings for the **Reliability** and **Maintainability** of your codebase, which help you understand your code health at a glance.
|
||
* A **results list** of all the quality issues detected on your default branch, which are grouped by rule and language.
|
||
|
||

|
||
|
||
## Identify a high-impact finding
|
||
|
||
Use the **dashboard filters** to identify a high severity level finding ("Error" or "Warning").
|
||
|
||
Resolving these will have the biggest impact on your repository's ratings.
|
||
|
||

|
||
|
||
### Inspect the details of the finding
|
||
|
||
Click the rule name itself to see a detailed view of the files and lines of code affected by that rule.
|
||
|
||

|
||
|
||
Once you're in the detailed view, click **Show more** to gather context and understand the results.
|
||
|
||

|
||
|
||
## Generate a {% data variables.copilot.copilot_autofix_short %}
|
||
|
||
To the right of a highlighted finding, click **{% octicon "copilot" aria-hidden="true" aria-label="copilot" %} Generate fix**.
|
||
|
||

|
||
|
||
Review the suggested fix, then click **Open pull request**.
|
||
|
||
### Merge the fix
|
||
|
||
Carefully review the draft pull request. If you're satisfied with the proposed changes, and all checks and tests are passing, go ahead and merge the pull request.
|
||
|
||
## Observe the metrics change
|
||
|
||
Return to the {% data variables.product.prodname_code_quality_short %} dashboard (**Security** tab, then **{% data variables.code-quality.code_quality_ui_views %}**, then **{% data variables.code-quality.all_findings %}**).
|
||
|
||
Wait a few minutes for the next scan to complete — {% data variables.product.prodname_code_quality_short %} scans automatically re-run after every push to the default branch.
|
||
|
||
Observe the change in metrics at the top of the dashboard:
|
||
|
||
* The **number of findings** for "Reliability" or "Maintainability" should have decreased.
|
||
* Your **ratings** for "Reliability" or "Maintainability" may have improved, if your fix addressed a number of high-impact findings.
|
||
|
||
To understand more about how the ratings are calculated, see [AUTOTITLE](/code-security/code-quality/reference/metrics-and-ratings).
|
||
|
||
## Conclusion
|
||
|
||
You've successfully used {% data variables.product.prodname_code_quality_short %} and {% data variables.copilot.copilot_autofix_short %} to improve your repository's code health!
|
||
|
||
Healthy code is easier to understand, maintain, and extend, and remediating code quality issues makes your codebase more reliable, compliant, and accelerates future development.
|
||
|
||
## Next steps
|
||
|
||
* Learn how {% data variables.product.prodname_code_quality %} works on pull requests to prevent code quality issues from reaching your default branch. See [AUTOTITLE](/code-security/code-quality/tutorials/fix-findings-in-prs).
|
||
* Provide feedback on {% data variables.product.prodname_code_quality %} in the [community discussion](https://github.com/orgs/community/discussions/177488?utm_source=docs-discussions-code-quality&utm_medium=docs&utm_campaign=universe25).
|