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 |
|
|
|
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 %}
-
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.
-
Click Create guideline.
-
Under "Name," give the coding guideline a name.
-
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.
-
Optionally, limit the coding guideline to specific file types or paths by clicking Add file path and adding path patterns.
You can use
fnmatchsyntax to define paths to target, with*as a wildcard to match any string of characters.{% data reusables.repositories.about-fnmatch %}
-
Test your coding guideline to make sure it works as expected.
- Click Add sample.
- 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.
- Click Save to save the code sample.
- Test the coding guideline against your sample by pressing {% octicon "play" aria-hidden="true" aria-label="play" %} Run.
-
Save your coding guideline, and turn it on, by clicking Save guideline.