-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.coderabbit.yaml
More file actions
275 lines (237 loc) · 7.96 KB
/
Copy path.coderabbit.yaml
File metadata and controls
275 lines (237 loc) · 7.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
# ──────────────────────────────────────────────
# CodeRabbit 配置 — Monolith 博客系统
# 文档:https://docs.coderabbit.ai/guides/configure-coderabbit
# ──────────────────────────────────────────────
# 审查语言设为中文
language: "zh-CN"
# 语气:专业简洁,关注代码质量
tone_instructions: >
请用简洁专业的中文回复,重点关注代码质量、类型安全和性能优化。
对于 UI 组件的改动,请注意响应式布局和双主题(暗色/亮色)兼容性。
# 开启早期测试功能
early_access: true
# 免费层功能
enable_free_tier: true
# ──────────────────────────────────────────────
# 审查设置
# ──────────────────────────────────────────────
reviews:
# 审查风格:chill(宽松反馈,不过于挑剔)
profile: "chill"
# 不自动 request changes(避免阻塞 CI)
request_changes_workflow: false
# 生成高层次摘要(写入 PR 描述)
high_level_summary: true
high_level_summary_placeholder: "@coderabbitai summary"
# 在 walkthrough 中也展示摘要
high_level_summary_in_walkthrough: true
# PR 变更文件摘要
changed_files_summary: true
# 生成序列图(便于理解 API 调用链路)
sequence_diagrams: true
# 代码审查工作量评估
estimate_code_review_effort: true
# 关联 Issue 评估
assess_linked_issues: true
# 关联 PR
related_prs: true
# 推荐标签
suggested_labels: true
auto_apply_labels: true
# 推荐审查者(个人项目暂时关闭)
suggested_reviewers: false
auto_assign_reviewers: false
# 审查状态
review_status: true
commit_status: true
fail_commit_status: false
# Walkthrough 折叠
collapse_walkthrough: true
# 审查细节(忽略的文件列表等)
review_details: true
# 关闭彩蛋小诗和 fortune
poem: false
in_progress_fortune: false
# 为 AI Agent 生成修复提示
enable_prompt_for_ai_agents: true
# ── 标签规则 ──
labeling_instructions:
- label: "frontend"
instructions: "当 PR 包含 client/ 目录下的文件变更时应用此标签"
- label: "backend"
instructions: "当 PR 包含 server/ 目录下的文件变更时应用此标签"
- label: "docs"
instructions: "当 PR 仅包含 README.md、Wiki 或 .md 文件变更时应用此标签"
- label: "styles"
instructions: "当 PR 主要修改 CSS/样式文件(如 globals.css)或 UI 组件外观时应用此标签"
- label: "bug"
instructions: "当 PR 标题或描述包含 fix/bugfix/修复 关键词时应用此标签"
- label: "feature"
instructions: "当 PR 标题或描述包含 feat/feature/新增 关键词时应用此标签"
# ── 文件过滤 ──
path_filters:
# 排除构建产物和依赖
- "!**/node_modules/**"
- "!**/dist/**"
- "!**/build/**"
- "!**/.wrangler/**"
- "!**/package-lock.json"
# 排除迁移文件(自动生成)
- "!server/src/db/migrations/**"
# ── 路径级审查指令 ──
path_instructions:
- path: "client/src/components/**"
instructions: >
这是 React 前端组件目录。审查时请关注:
1. 是否同时兼容暗色和亮色主题(检查 CSS 变量和 data-theme)
2. 响应式布局是否完整(移动端/平板/桌面端)
3. 无障碍访问(aria 标签、键盘导航)
4. 组件是否保持单一职责
- path: "client/src/pages/**"
instructions: >
页面级组件。审查时请关注:
1. 数据加载和错误处理是否完善
2. SEO 相关(页面标题、meta 标签)
3. 导航和路由是否正确
- path: "client/src/globals.css"
instructions: >
全局样式和 CSS 变量系统。审查时请关注:
1. [data-theme="light"] 和默认暗色主题的变量是否配对
2. OKLCH 色值的明度/色度是否合理
3. 是否有遗漏的选择器未覆盖亮色模式
- path: "server/src/storage/**"
instructions: >
存储适配器层(数据库 + 对象存储)。审查时请关注:
1. 接口实现是否完整(IDatabase / IObjectStorage)
2. SQL 注入防护(参数化查询)
3. 多后端(D1/Turso/PostgreSQL)行为一致性
4. 错误处理和边界情况
- path: "server/src/index.ts"
instructions: >
Hono Workers API 路由总入口。审查时请关注:
1. JWT 认证中间件是否正确保护管理接口
2. CORS 配置是否安全
3. 请求参数验证
- path: "client/functions/**"
instructions: >
Cloudflare Pages Functions(API 反向代理层)。审查时请关注:
1. 代理目标 URL 是否正确构建
2. 请求头的传递和清理
3. 错误响应处理
# ── 自动审查 ──
auto_review:
enabled: true
auto_incremental_review: true
auto_pause_after_reviewed_commits: 5
drafts: false
# 忽略 bot 的 PR
ignore_title_keywords:
- "WIP"
- "DO NOT MERGE"
- "wip"
base_branches: []
# ── Anti-Slop 检测 ──
slop_detection:
enabled: true
# ── Finishing Touches ──
finishing_touches:
docstrings:
enabled: true
unit_tests:
enabled: true
simplify:
enabled: true
# ── Pre-merge 检查 ──
pre_merge_checks:
title:
mode: "warning"
requirements: >
PR 标题应遵循 Conventional Commits 格式:
type(scope): description
类型包括:feat, fix, docs, style, refactor, perf, test, chore
description:
mode: "warning"
docstrings:
mode: "off"
# ── 工具配置 ──
tools:
# 启用与项目相关的 Lint 工具
biome:
enabled: true
eslint:
enabled: true
markdownlint:
enabled: true
yamllint:
enabled: true
actionlint:
enabled: true
ast-grep:
essential_rules: true
# 安全扫描
gitleaks:
enabled: true
trufflehog:
enabled: true
github-checks:
enabled: true
timeout_ms: 120000
# 关闭不相关的语言工具
shellcheck:
enabled: false
ruff:
enabled: false
phpstan:
enabled: false
phpmd:
enabled: false
phpcs:
enabled: false
golangci-lint:
enabled: false
swiftlint:
enabled: false
hadolint:
enabled: false
checkov:
enabled: false
tflint:
enabled: false
detekt:
enabled: false
flake8:
enabled: false
rubocop:
enabled: false
buf:
enabled: false
regal:
enabled: false
pmd:
enabled: false
clang:
enabled: false
cppcheck:
enabled: false
fortitudeLint:
enabled: false
# ──────────────────────────────────────────────
# 聊天设置(PR 中 @coderabbitai 交互)
# ──────────────────────────────────────────────
chat:
auto_reply: true
# ──────────────────────────────────────────────
# 知识库
# ──────────────────────────────────────────────
knowledge_base:
learnings:
scope: "auto"
issues:
scope: "auto"
jira:
project_keys: []
linear:
team_keys: []
pull_requests:
scope: "auto"