0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

日英のエンジニアが混在するチームにお勧めのCodeRabbit設定

0
Posted at

CodeRabbitはAIコードレビューサービスです。GitHubやGitLabなどと連携し、PRを自動的にコードレビューします。VS Code機能拡張やCLIも提供しており、こちらは無料で利用できます。パブリックなリポジトリであれば、CodeRabbitを無料で利用できます。

今回は、ユーザーの方からお聞きしたCodeRabbit設定のTipsについて紹介します。

こんなチームで役立ちます

このTipsは、以下のようなチームや個人で役立つはずです。タイトルは日英ですが、それだけに限りません。

  • 日本と海外に開発拠点のあるチーム(オフショア含む)
  • OSSで海外からのコントリビュートがある

設定について

.coderabbit.yamltone_instructions に、以下のように記述しましょう。

tone_instructions: "Write all reviews in both Japanese and English."

これは、レビューのトーン設定ですが、ここにレビューは日英で書いて欲しいと指示しておきます。日韓でも、日中でも良いです。

実際のレビューについて

実際のレビューはこちらを参考にしてください。

レビュー概要(ウォークスルー)には、以下のように出力されています。

**English:**  
This PR updates documentation to reflect new editor synchronization behavior for internal wiki navigation and implements corresponding async control flow changes in the preview handler. Navigation now opens destination files in the editor alongside updating the preview.

**日本語:**  
このPRは、内部Wikiナビゲーションのエディタ同期動作を反映するようにドキュメントを更新し、プレビューハンドラーで対応する非同期制御フロー変更を実装しています。ナビゲーション時にプレビュー更新と同時にエディタで宛先ファイルを開くようになります。

image.png

また、レビュー詳細は以下のようになっています。

## 日本語レビュー詳細 / Japanese Detailed Review

このPRは非常によく整理されています!ドキュメントと実装の整合性が保たれており、変更の意図が明確です。

**良い点 / Good Points:**
- ✨ ドキュメントの更新と実装が完全に同期しており、保守性が高い
- ✨ 非同期処理への移行が明確で、`void`を使った無視パターンで明示的に制御フロー意図を示している
- ✨ 新しいヘルパーメソッド `openUriInEditor()` で責任分離が適切

**確認推奨事項 / Items to Verify:**
- `openUriInEditor()` が常に正常に完了することを確認(エラーハンドリングはありますか?)
- ナビゲーション時にフォーカスが適切に移動することを確認(`preserveFocus: false`の動作)

---

## English Detailed Review / 英語詳細レビュー

This PR is very well-organized! Documentation and implementation are perfectly synchronized, with clear intent.

**Strengths / 強み:**
- ✨ Documentation and code changes are perfectly in sync—excellent for maintainability
- ✨ The transition to async is explicit, with `void` usage clearly indicating intentional Promise handling
- ✨ The new `openUriInEditor()` helper properly separates concerns

**Recommendations / 推奨事項:**
- Please verify that `openUriInEditor()` always completes successfully—are there error handling mechanisms in place?
- Confirm that keyboard focus properly transfers during navigation (validate `preserveFocus: false` behavior)

実際のレビュー部分については、以下のような内容です。

`137-143`: **パストラバーサルの潜在的リスク / Potential path traversal risk** ⚠️

`filePath` はwebviewメッセージから直接受け取った値であり、`path.join(this.docsRoot, filePath)` で結合されています。もし `filePath``../../` のようなディレクトリトラバーサルシーケンスが含まれていた場合、`docsRoot` 外のファイルにアクセスできる可能性があります。

webviewは拡張機能自身のコードなのでリスクは低いですが、防御的プログラミングとしてパスがdocsRoot内に収まることを検証することを検討してください。

The `filePath` is received directly from the webview message and joined with `path.join(this.docsRoot, filePath)`. If `filePath` contains directory traversal sequences like `../../`, it could potentially access files outside `docsRoot`.

While the risk is low since the webview runs our own code, consider validating that the resolved path stays within docsRoot as a defensive measure.

image.png

日英完璧な表記ではありませんが、翻訳する手間は幾分下がりそうです。また、指示方法を変更すれば、より日英をはっきり分割した表示もできるでしょう。

まとめ

LLMは自然言語の書き方で色々カスタマイズできるので、こういった予想外の対応もできるのが面白いですね。チームに英語話者がいるチームなどは、このテクニックでお互いストレスないレビュー体制を築いてください。

AIコードレビュー | CodeRabbit | 無料トライアル可能

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?