1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/content/copilot/how-tos/use-copilot-agents/request-a-code-review/configure-coding-guidelines.md

3.1 KiB

title, shortTitle, intro, allowTitleToDifferFromFilename, versions, topics, redirect_from, contentType
title shortTitle intro allowTitleToDifferFromFilename versions topics redirect_from contentType
Configuring coding guidelines for GitHub Copilot code review Configure coding guidelines Learn how to customize {% data variables.copilot.copilot_code-review_short %} with custom coding guidelines. true
feature
copilot
Copilot
/early-access/copilot/code-review/configuring-coding-guidelines
/early-access/copilot/code-reviews/configuring-coding-guidelines
/copilot/using-github-copilot/code-review/configuring-coding-guidelines
/copilot/how-tos/agents/copilot-code-review/configuring-coding-guidelines
/copilot/how-tos/agents/copilot-code-review/configure-coding-guidelines
/copilot/how-tos/agents/request-a-code-review/configure-coding-guidelines
how-tos

{% data reusables.copilot.code-review.custom-coding-guidelines-prerequisites %} See AUTOTITLE.

About coding guidelines

You can provide {% data variables.product.prodname_copilot_short %} with a set of coding guidelines, written in natural language, that will help it review your code in a way that aligns with your organization's coding style and best practices. For more information—including examples of coding guidelines—see AUTOTITLE.

Creating a coding guideline

{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}

  1. In the "Code & automation" section of the sidebar, click {% octicon "copilot" aria-hidden="true" aria-label="copilot" %} {% data variables.product.prodname_copilot_short %}, then Code review.

  2. Click Create guideline.

  3. Under "Name," give the coding guideline a name.

  4. Under "Description," provide a description of the coding guideline up to 600 characters long. This will be used by {% data variables.product.prodname_copilot_short %} to understand your coding style and to decide when to leave a comment.

    How you write your description has a big impact on the quality of comments that {% data variables.product.prodname_copilot_short %} will generate. For help with writing effective coding guidelines, see AUTOTITLE.

  5. Optionally, limit the coding guideline to specific file types or paths by clicking Add file path and adding path patterns.

    You can use fnmatch syntax to define paths to target, with * as a wildcard to match any string of characters.

    {% data reusables.repositories.about-fnmatch %}

  6. Test your coding guideline to make sure it works as expected.

    1. Click Add sample.
    2. Add your own sample, or press {% octicon "copilot" aria-hidden="true" aria-label="copilot" %} Generate code sample to automatically generate a code sample based on your title and description.
    3. Click Save to save the code sample.
    4. Test the coding guideline against your sample by pressing {% octicon "play" aria-hidden="true" aria-label="play" %} Run.
  7. Save your coding guideline, and turn it on, by clicking Save guideline.