-
Notifications
You must be signed in to change notification settings - Fork 9
CI: coderabbit review config #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f757d2d
CI: coderabbit review config
luojiyin1987 be7cdb9
CI: coderabbit review config
luojiyin1987 936d7f7
fix: typo
luojiyin1987 8e34aff
fix: from review
luojiyin1987 e387d22
fix: from review
luojiyin1987 3724b0b
fix: from review
luojiyin1987 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # .coderabbit.yaml for Open Source Bazaar 项目 | ||
|
|
||
| # ----------------- | ||
| # 核心设置 | ||
| # ----------------- | ||
|
|
||
| # 设置 CodeRabbit 回复的语言 (e.g., "en", "zh-CN") | ||
| language: "zh-CN" | ||
|
|
||
| # ----------------- | ||
| # 审查配置 | ||
| # ----------------- | ||
|
|
||
| reviews: | ||
| # 高级摘要配置 | ||
| high_level_summary: true | ||
| high_level_summary_placeholder: "这是 Open Source Bazaar 项目的 PR 变更摘要" | ||
|
|
||
| # 路径过滤 - 排除 Next.js 项目中不需要审查的文件和目录 | ||
| path_filters: | ||
| - "src/**" | ||
| - "pages/**" | ||
| - "components/**" | ||
| - "models/**" | ||
| - "!**/*.md" | ||
| - "!**/*.{bin,csv}" | ||
| - "!node_modules/**" | ||
| - "!.next/**" | ||
| - "!public/**" | ||
| - "!out/**" | ||
| - "!next-env.d.ts" | ||
| - "!package-lock.json" | ||
| - "!pnpm-lock.yaml" | ||
| - "!yarn.lock" | ||
| - "!**/__snapshots__/**" | ||
|
|
||
| # 代码生成指令 | ||
| code_generation: | ||
| docstrings: | ||
| path_instructions: | ||
| "pages/**": "确保所有用户界面文本使用 t() 函数进行国际化翻译" | ||
| "components/**": "必须使用 React Bootstrap 组件替代自定义 HTML 元素" | ||
| "models/**": "检查 MobX store 的正确使用,包括 @observer、@observable、@action、@computed" | ||
|
|
||
| # 工具配置 | ||
| tools: | ||
| typescript: | ||
| enabled: true | ||
| config: "tsconfig.json" | ||
| eslint: | ||
| enabled: true | ||
| config: "eslint.config.ts" | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| # 全局语气指令 | ||
| tone_instructions: | | ||
| 这是一个基于 Next.js 15 (Pages Router) + TypeScript + MobX + React Bootstrap 的项目。请像一位资深的开发者一样进行审查,并严格遵循以下规则: | ||
|
|
||
| 1. **React Bootstrap 组件使用**: | ||
| - 必须使用 React Bootstrap 组件替代自定义 HTML 元素 | ||
| - 使用 `<Button variant="outline-primary">` 而不是 `<a className="btn btn-outline-primary">` | ||
| - 使用 `<Badge bg="secondary">` 而不是 `<span className="badge bg-secondary">` | ||
| - 优先使用现有的 Bootstrap 组件库 | ||
|
|
||
| 2. **MobX 状态管理**: | ||
| - 检查 MobX store 的正确使用,包括 `@observer` 装饰器 | ||
| - 确保 `@observable`、`@action`、@computed` 的正确使用 | ||
| - 验证组件正确连接到 MobX store | ||
|
|
||
| 3. **国际化 (i18n) 要求**: | ||
| - 所有用户界面文本必须使用 `t()` 函数进行翻译 | ||
| - 检查翻译键是否在所有语言文件中存在 (zh-CN.ts, en-US.ts, zh-TW.ts) | ||
| - 使用通用术语如 `t('knowledge_base')` 而不是特定术语 | ||
|
|
||
| 4. **GitHub API 集成**: | ||
| - 检查是否从 `models/Base.ts` 导入配置的 `githubClient` | ||
| - 验证 GitHub API 认证和错误处理的正确实现 | ||
| - 确保 Base64 内容编解码使用 `web-utility` 包中的 `encodeBase64()`、`decodeBase64()`,以便正确处理 Unicode | ||
|
|
||
| 5. **Pages Router 最佳实践**: | ||
| - 检查 `getStaticProps` 和 `getServerSideProps` 的正确使用 | ||
| - 验证 API 路由的结构和错误处理 | ||
| - 确保静态生成时的错误处理(让错误自然冒泡) | ||
|
|
||
| 6. **TypeScript 类型安全**: | ||
| - 强类型定义,避免使用 `any` 类型 | ||
| - 正确使用泛型和接口 | ||
| - 确保 React 组件 props 正确类型化 | ||
|
|
||
| 7. **性能优化**: | ||
| - 使用 `next/image` 组件进行图片优化 | ||
| - 检查不必要的重新渲染 | ||
| - 确保 MobX 的响应式性能优化 | ||
|
|
||
| 8. **代码组织**: | ||
| - 遵循现有的项目结构 | ||
| - 使用现有的工具库(如 `web-utility`) | ||
| - 保持代码的可读性和模块化 | ||
|
luojiyin1987 marked this conversation as resolved.
Outdated
luojiyin1987 marked this conversation as resolved.
Outdated
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.