Canonical: https://weaveos.com/zh-cn/checks

[跳至内容](https://weaveos.com/zh-cn/checks#checks-content)

# 您团队的标准，在每个拉取请求上

错误审阅者寻找缺陷。Weave Checks 针对每个拉取请求运行您团队的 Markdown 规则。

[在 GitHub 上设置](https://github.com/weave-os/checks#getting-started) [查看示例](https://weaveos.com/zh-cn/checks#try-checks)

暂停

## PR 可以通过测试但仍未达到您的标准。

保留您的 Bug 审查员以处理缺陷。使用 Weave 检查（Checks）来执行特定于您代码库的规则。

您的 Bug 评审人员询问

### “这会坏吗？”

逻辑错误、回归和边缘情况。

Weave 检查请求

### “这符合我们的标准吗？”

它会标记模糊的名称、死代码以及未对代码进行测试的测试用例。

冗余注释 一次性抽象 同义反复测试

## 重复代码的注释

标记那些重申代码已说明内容的注释。解释决策、约束或令人惊讶之处的注释是可以的。

1. 1 发现
2. 2 修复已推送
3. 3 已解决

暂停

src/users.ts

! 已标记代码

```
1!Flagged: // Get the user's full name2 export function getFullName(user: User) {3   return `${user.first} ${user.last}`;4 }
```

weave-checks 发现

此注释重申了函数名称。请将其删除，或替换为代码无法告诉读者的内容。

src/users.ts

− 已移除 + 已添加

```
1−Removed: // Get the user's full name1 export function getFullName(user: User) {2   return `${user.first} ${user.last}`;3 }
```

weave-checks 修复已推送

A new commit addresses the comment.

src/users.ts

```
1 export function getFullName(user: User) {2   return `${user.first} ${user.last}`;3 }
```

weave-checks 线程已解决

The comment was removed. Resolving this thread.

查看每个审查阶段的完整代码

发现 · 已标记行：1

```
// Get the user's full name
export function getFullName(user: User) {
  return `${user.first} ${user.last}`;
}
```

修复已推送

```
- // Get the user's full name
export function getFullName(user: User) {
  return `${user.first} ${user.last}`;
}
```

线程已解决

```
export function getFullName(user: User) {
  return `${user.first} ${user.last}`;
}
```

这是一个图示示例，而非实时审查。由您或您的编码智能体推送修复程序。[查看真实评审](https://github.com/weave-os/checks/pull/1#pullrequestreview-5348408708)

## 每个检查都是一个 Markdown 文件。

Frontmatter 设置名称和模型层级。其余部分是描述要标记内容的纯英语。Checks 会根据它审查每个差异，并对任何违反规则的内容进行评论。

评论 重复代码的注释 架构 单用途抽象 测试 仅检查自身的测试

[探索检查库](https://github.com/weave-os/checks/tree/main/checks-library)

.weave-checks/documentation-signal.md

```
---
name: Documentation Signal
description: Flags comments that repeat the code
intelligence: low
---

## What to look for
Comments that restate what the next line does.

## What not to flag
- Comments that explain a constraint or workaround
- Comments that explain why a decision was made
- Links to issues or specs
```

显示 Documentation Signal Markdown 示例。

## 我们在自己的代码上运行的检查

[所有入门检查](https://github.com/weave-os/checks/tree/main/starter-checks)

- [命名清晰度 标记像 data2 这样隐藏了值用途的新名称。](https://github.com/weave-os/checks/blob/main/starter-checks/naming-clarity.md)
- [死代码路径 标记未使用的参数、无法到达的分支以及尚未被调用的功能。](https://github.com/weave-os/checks/blob/main/starter-checks/dead-code-paths.md)
- [防御性编程 为不可能发生的情况标记空值检查和回退。](https://github.com/weave-os/checks/blob/main/starter-checks/defensive-programming.md)
- [重复造轮子 标记库或平台 API 已经可以完成工作的自写代码。](https://github.com/weave-os/checks/blob/main/starter-checks/reinventing-the-wheel.md)

## 分三步完成设置。

检查在 GitHub Actions 中运行，并与 Weave Router 或任何兼容 Anthropic 的提供商配合使用。

在本地运行检查

$ npx @weave-os/checks run

[完整设置说明](https://github.com/weave-os/checks#getting-started)

1. 01

   ### 安装 GitHub 应用程序

   选择 Checks 可以审查哪些存储库。

   [安装应用](https://github.com/apps/weave-checks/installations/new)

2. 02

   ### 添加 Router 密钥

   创建一个 Weave Router 密钥并将其保存为名为 WEAVE\_ROUTER\_KEY 的仓库机密。

   [创建一个密钥](https://router.weaveos.com/build)

3. 03

   ### 添加工作流

   提交工作流文件。它默认运行启动检查。将您自己的检查作为 Markdown 文件添加到 .weave-checks 中。

   [获取工作流](https://github.com/weave-os/checks/blob/main/examples/weave-checks.yml)

## 常见问题

这是另一个人工智能错误审查器吗？

不。Bug 评审者寻找的是缺陷。检查（Checks）标记的是队友在评审中会指出的标准，例如命名、结构和测试质量。请将其与您的 Bug 评审者一起运行。

Checks 会更改我的代码吗？

不。它会在拉取请求上留下评审意见。您或您的编码代理推送修复程序，Checks 会在下一次运行时解决该线程。

成本是多少？

Checks 是免费且开源的。您需要为模型使用和任何 GitHub Actions 分钟付费。您的成本取决于您的检查、您的差异以及您选择的模型。

GitHub 应用程序需要什么访问权限？

检查和拉取请求具有发布审查的写入权限，内容具有解决审查线程的写入权限。代理的工具是只读的，它永远不会看到应用程序令牌。每次运行都使用一个作用域限定为存储库的短期令牌，该令牌在作业完成时会被撤销。Fork 拉取请求将被跳过。

## 从一个检查开始。

挑选你最常留下的审查评论，并将其写下来作为检查项。

[设置 Weave 检查](https://github.com/weave-os/checks#getting-started) [查看源代码](https://github.com/weave-os/checks)
