Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: ja
early_access: false
tone_instructions: |
日本語で簡潔かつ建設的にレビューしてください。
指摘の根拠(PHPのバージョン依存、型安全性、Result型の不変条件など)を明示してください。

reviews:
profile: assertive
request_changes_workflow: false
high_level_summary: true
poem: false
review_status: true
collapse_walkthrough: false

auto_review:
enabled: true
drafts: false
base_branches:
- main

path_filters:
- "!vendor/**"
- "!**/*.lock"
- "!.phpunit.result.cache"
- "!.php-cs-fixer.cache"
- "!.phpstan/**"

path_instructions:
- path: "src/**/*.php"
instructions: |
- PHP 8.4 以上の構文・機能を前提にレビューする。
- Rust の Result<T, E> に倣った API 設計を尊重し、Ok / Err / Result の不変条件を崩していないか確認する。
- 例外による暗黙のエラー伝播ではなく、Result 型での明示的なエラーハンドリングを推奨する。
- readonly / final / 型宣言(戻り値・引数・プロパティ)の徹底をチェックする。
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

readonlyfinal はクラスにのみ適用可能な修飾子です。src/ 配下には Result.php インターフェースが含まれているため、AI がインターフェースに対してもこれらの適用を求めてしまう誤検知(ハルシネーション)を防ぐため、「クラスにおける」という限定を加えることを推奨します。

        - クラスにおける readonly / final の適用、および型宣言(戻り値・引数・プロパティ)の徹底をチェックする。

- 公開 API の破壊的変更がある場合は明示的に指摘する。
- path: "tests/**/*.php"
instructions: |
- PHPUnit のテストとして、t-wada 流 TDD の Red→Green→Refactor を意識しているかをチェックする。
- 1 テスト 1 アサーション主義に偏りすぎず、振る舞い単位で検証されているか確認する。
- エッジケース(Ok/Err 双方、ネスト、map/and_then などのコンビネータ)が網羅されているかを見る。
- path: "**/*.md"
instructions: |
- サンプルコードは PHP 8.4+ で実行可能か確認する。
- README の API 説明と src の実装が一致しているかを確認する。
- path: ".github/workflows/**"
instructions: |
- 使用するアクションはバージョンを固定(SHA か明示的なタグ)しているかを確認する。
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

GitHub Actions のセキュリティベストプラクティスでは、アクションの参照にはタグ(v4 など)ではなく、不変な SHA-1 ハッシュを使用することが推奨されます。現在の記述でも SHA に言及されていますが、優先順位を明確にすることで、よりセキュアなレビュー結果を得やすくなります。

        - 使用するアクションはバージョンを固定(セキュリティ確保のため可能な限り SHA、困難な場合は明示的なタグ)しているかを確認する。

- secrets の取り扱いに不適切なものがないかをチェックする。

tools:
phpstan:
enabled: true
level: default
phpmd:
enabled: false
github-checks:
enabled: true
timeout_ms: 90000
languagetool:
enabled: true
enabled_only: false
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

enabled_only: false の場合、path_filters で除外したファイル(キャッシュファイルやロックファイルなど)に対しても LanguageTool が実行される可能性があります。他のツールとの整合性を保ち、不要なノイズを避けるため、true に設定してフィルターを尊重させることを推奨します。

      enabled_only: true

level: default
markdownlint:
enabled: true
yamllint:
enabled: true
actionlint:
enabled: true
gitleaks:
enabled: true

chat:
auto_reply: true
Loading