Skip to main content

Managing static analysis tools in Copilot code review

Improve your code security and linting configuration with static analysis tools in Copilot 代码评审.

谁可以使用此功能?

Repository administrators and organization owners

Rulesets are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud.

Prerequisites

If you get access to Copilot through an organization or enterprise, your organization or enterprise owner needs to enable preview features for Copilot 代码评审. See 管理组织中的 GitHub Copilot 策略和功能 and 管理企业中 GitHub Copilot 的策略和功能.

Managing static analysis tools for your repository

  1. 在 GitHub 上,导航到存储库的主页面。

  2. 在仓库名称下,单击 “Settings”****。 如果看不到“设置”选项卡,请选择“”下拉菜单,然后单击“设置”。

    存储库标头的屏幕截图,其中显示了选项卡。 “设置”选项卡以深橙色边框突出显示。

  3. 在左侧边栏的“代码和自动化”下,单击“规则”,然后单击“规则集” 。

    存储库“设置”页边栏的屏幕截图。 “规则”子菜单已展开,“规则集”选项以橙色轮廓突出显示。

  4. Edit or create a ruleset for Copilot 代码评审:

    • If you have configured a ruleset for automatic reviews from Copilot 代码评审, click the name of that ruleset.
    • If you do not have an existing ruleset for Copilot 代码评审, select the New ruleset dropdown menu, then click New branch ruleset and give your ruleset a name.
  5. In the "Rules" section, select Manage static analysis tools in Copilot 代码评审.

  6. To update the tools that Copilot 代码评审 will use, select the Select tools dropdown menu, then select or deselect the available tools.

  7. To apply your selections, at the bottom of the page, click Create or Save changes.

Configuring static analysis tools for your organization

  1. 在 GitHub 上,导航到组织的主页面。

  2. 在组织名称下,单击 “Settings”****。 如果看不到“设置”选项卡,请选择“”下拉菜单,然后单击“设置”********。

    组织配置文件中选项卡的屏幕截图。 “设置”选项卡以深橙色标出。

  3. 在左边栏的“Code, planning, and automation”部分,单击“ Repository”,然后单击“Rulesets”********。

    组织的设置页面的屏幕截图。 在边栏中,标有“规则集”的链接以橙色轮廓突出显示。

  4. Edit or create a ruleset for Copilot 代码评审:

    • If you have configured a ruleset for automatic reviews from Copilot 代码评审, click the name of that ruleset.
    • If you do not have an existing ruleset for Copilot 代码评审, select the New ruleset dropdown menu, then click New branch ruleset and give your ruleset a name.
  5. In the "Rules" section, select Manage static analysis tools in Copilot 代码评审.

  6. To update the tools that Copilot 代码评审 will use, select the Select tools dropdown menu, then select or deselect the available tools.

  7. To apply your selections, at the bottom of the page, click Create or Save changes.