-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the Walkthrough添加 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing Touches🧪 Generate unit tests
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a CodeRabbit configuration file to establish automated code review guidelines for the Open Source Bazaar project. The configuration specifically tailors review instructions for a Next.js 15 + TypeScript + MobX + React Bootstrap tech stack.
- Configures Chinese language support for CodeRabbit reviews
- Defines comprehensive exclusion patterns for build artifacts and dependencies
- Establishes detailed review instructions covering React Bootstrap usage, MobX patterns, i18n requirements, and TypeScript best practices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (7)
.coderabbit.yaml (7)
14-40
: 将顶层 exclude 迁移为 reviews.path_filters(更贴合官方 schema,便于 sparse-checkout)按 schema,应优先使用 reviews.path_filters 且以 "!" 前缀表示排除。建议改为如下结构,语义等价、更稳健(同时覆盖任意深度的 node_modules/snapshots):
-exclude: - # 这是最重要的排除项!'.next' 目录包含了所有的构建输出、开发缓存和服务端代码。 - - ".next/**" - - # node_js 依赖 - - "node_modules/**" - - # public 目录通常存放静态资源(图片、字体等),一般不需要代码审查。 - - "public/**" - - # next export 的输出目录 - - "out/**" - - # 自动生成的 TypeScript 类型定义文件 - - "next-env.d.ts" - - # 依赖锁定文件 - - "package-lock.json" - - "pnpm-lock.yaml" - - "yarn.lock" - - # 测试快照 - - "**/__snapshots__/**" - - # 文档文件 - - "**/*.md" +reviews: + path_filters: + # 构建输出、缓存与服务端代码 + - '!.next/**' + # 依赖目录(任意深度) + - '!**/node_modules/**' + # 静态资源与导出目录 + - '!public/**' + - '!out/**' + # 生成物与锁文件 + - '!next-env.d.ts' + - '!package-lock.json' + - '!pnpm-lock.yaml' + - '!yarn.lock' + # 测试快照(任意深度) + - '!**/__snapshots__/**' + # Markdown 文档(若希望也审校文档,可去掉此行) + - '!**/*.md'为确保与当前 CodeRabbit 版本兼容,请确认顶层 exclude 是否仍被正式支持;若不确定,建议采用上述 path_filters。
23-23
: 移除行尾多余空白YAMLlint 报告第 23 行存在尾随空格。
- +
55-59
: MobX 指南偏旧,建议改为 MobX 6+ 实践避免装饰器默认前提;更推荐 makeAutoObservable/observer(mobx-react-lite)。
- - 检查 MobX store 的正确使用,包括 `@observer` 装饰器 - - 确保 `@observable`、`@action`、`@computed` 的正确使用 - - 验证组件正确连接到 MobX store + - 优先使用 `makeAutoObservable`/`makeObservable` 构建 store;仅在已启用 `experimentalDecorators` 时才使用装饰器 + - 组件使用 `observer`(mobx-react-lite)包装,并最小化可观察数据读取范围 + - 验证组件正确连接到 store,避免非可观察对象导致的渲染遗漏
60-64
: i18n 不要硬编码语言文件名用“受支持语言集合”更稳妥,避免与实际文件命名不一致。
- - 检查翻译键是否在所有语言文件中存在 (zh-CN.ts, en-US.ts, zh-TW.ts) + - 检查翻译键是否在所有受支持语言的资源文件中存在(不要硬编码具体文件名)
70-74
: Pages Router 最佳实践可再补一条避免混用避免与 App Router 混用同一路由段更安全。
- 检查 `getStaticProps` 和 `getServerSideProps` 的正确使用 + - 禁止与 App Router 混用同一路由段,避免数据获取语义冲突 - 验证 API 路由的结构和错误处理
80-84
: 性能项小补充:字体引入 next/font 可避免 FOUT/FOIT。
- 使用 `next/image` 组件进行图片优化 + - 使用 `next/font` 管理字体以避免 FOUT/FOIT - 检查不必要的重新渲染
94-94
: 文件末尾缺少换行YAMLlint 提示无结尾换行。请在文件末尾加一空行。
-summarize: "default" +summarize: "default" +
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.coderabbit.yaml
(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.coderabbit.yaml
[error] 23-23: trailing spaces
(trailing-spaces)
[error] 94-94: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (3)
.coderabbit.yaml (3)
1-1
: 语言设置妥当与配置枚举一致(zh-CN)。无需改动。
49-54
: React Bootstrap 使用规范清晰以组件替代裸 HTML 的要求明确,有助于一致性与可访问性。
85-89
: 代码组织指引合理强调沿用现有结构与工具库有助于降低认知负担。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
♻️ Duplicate comments (1)
.coderabbit.yaml (1)
19-36
: Reconsider excluding entire public/ directory**Excluding public/** can hide important assets/config (e.g., robots.txt, manifest.json). Prefer targeted binary exclusions.
Apply a narrower exclusion:
- - "!public/**" + - "!public/**/*.{png,jpg,jpeg,gif,webp,svg,ico,mp4,mp3,woff,woff2,ttf,otf}" +# 可保留如 public/robots.txt、manifest.json 等文本资产参与审查
🧹 Nitpick comments (3)
.coderabbit.yaml (3)
18-18
: YAML lint nits: trailing spaces and newline at EOF
- Line 18 has trailing spaces.
- Ensure the file ends with a single newline.
- +Also applies to: 98-98
14-18
: High-level summary placeholder OK; remove trailing whitespacePlaceholder is fine; just clean trailing space on the following blank line.
- +
80-83
: “让错误自然冒泡”在 SSG/ISR 场景要点明构建失败预期For getStaticProps/getServerSideProps, “bubble up errors” can fail builds unexpectedly. Consider clarifying to log and return notFound/revalidate as appropriate.
Would you like a one-liner to add here as guidance?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.coderabbit.yaml
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-10T16:34:31.632Z
Learnt from: TechQuery
PR: Open-Source-Bazaar/Open-Source-Bazaar.github.io#34
File: .coderabbit.yaml:65-69
Timestamp: 2025-09-10T16:34:31.632Z
Learning: 在 Open-Source-Bazaar.github.io 中,Base64 编解码应优先使用 web-utility 的 encodeBase64()/decodeBase64(),以确保 Unicode 正确性与跨运行时一致性;仅在未使用该依赖时,浏览器端可用 atob/btoa,Node/SSR 端用 Buffer.from(...,'base64').toString('utf8') 作为兜底。
Applied to files:
.coderabbit.yaml
📚 Learning: 2025-09-10T16:34:31.632Z
Learnt from: TechQuery
PR: Open-Source-Bazaar/Open-Source-Bazaar.github.io#34
File: .coderabbit.yaml:65-69
Timestamp: 2025-09-10T16:34:31.632Z
Learning: Open-Source-Bazaar.github.io 项目已在依赖中使用 web-utility v4.5.3,并在 pages/wiki/[...slug].tsx 中正确使用 decodeBase64() 进行 Base64 解码。配置文件应该引导使用 web-utility 的 Base64 方法而不是原生 atob/btoa。
Applied to files:
.coderabbit.yaml
🪛 YAMLlint (1.37.1)
.coderabbit.yaml
[error] 18-18: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build-and-Deploy
🔇 Additional comments (2)
.coderabbit.yaml (2)
7-8
: Language setting LGTMlanguage: "zh-CN" is valid per schema and matches project needs.
74-78
: Base64 guidance aligns with project learningsUsing web-utility’s encodeBase64/decodeBase64 is correct for Unicode and cross-runtime. Keep this.
Checklist(清单):
Closes #XXXXX
Summary by CodeRabbit