CodeRabbitはAIコードレビューサービスです。GitHubやGitLabなどと連携し、PRを自動的にコードレビューします。VS Code機能拡張やCLIも提供しており、こちらは無料で利用できます。パブリックなリポジトリであれば、CodeRabbitを無料で利用できます。
CodeRabbitは、コードレビューを行う際に各種Linter/SASTツールを利用しています。ほとんどのツールはデフォルトで有効になっていますが、幾つかのルールについては設定が必要です。設定されていないと、せっかくの機能が活かせないので、ぜひ活用してください!
actionlint
.github/workflows/ がないと実行されません。
ast-grep
reviews.tools.ast-grep 以下に対して、下記のいずれかが設定されている場合にのみ、実行されます。
- rule_dirs
- essential_rules
- packages
util_dirs 設定はオプションです。
reviews:
tools:
ast-grep:
rule_dirs:
- "rules/javascript"
- "rules/python"
util_dirs:
- "utils"
essential_rules: true
packages:
- "owner/custom-rules"
CircleCI
以下のパスにファイルが必要です。
.circleci/config.yml.circleci/config.yaml
Clippy
Cargo.toml が必須です。設定ファイルとして clippy.toml または .clippy.toml を指定できますが、ない場合にはデフォルトの設定が採用されます。
Dotenv Linter
.env ではじまるファイル名に対して適用されます。 .env.local は有効ですが、 test.env には適用されません。
Flake8
設定ファイル .flake8 が必須です。
OpenGrep
以下の設定ファイルのいずれかが必要です。
- opengrep.yml
- opengrep.yaml
- opengrep.config.yml
- opengrep.config.yaml
- semgrep.yml
- semgrep.yaml
- semgrep.config.yml
- semgrep.config.yaml
Oxlint
以下の設定ファイルのいずれかがあることと、 Biome が無効になっている必要があります。
- .oxlintrc.json
- oxlintrc.json
- .oxlintrc
- oxlint.json
PHPCS
設定ファイル phpcs.xml または phpcs.xml.dist が必須です。また、 レビューのプロフィール が assertive になっていないといけません(デフォルトはchillです)。
profile: assertive
PHPStan
以下の設定ファイルのいずれかが必要です。
- phpstan.neon
- phpstan.neon.dist
- phpstan.dist.neon
また、設定ファイルには paths パラメータが必要です。逆に bootstrapFile または bootstrapFiles があってはいけません。
PMD
ruleset.xml というファイルを配置するか、 .coderabbit.yaml にて reviews.tools.pmd.config_file にて設定ファイルのパスを指定する必要があります。
reviews:
tools:
pmd:
config_file: "/path/to/config.xml"
Prisma Lint
以下の設定ファイルのいずれかが必要です。
- .prismalintrc.json
- .prismalintrc
- .prismalintrc.js
- .prismalintrc.yaml
- .prismalintrc.yml
- prismalint.config.js
Pylint
以下の設定ファイルのいずれかが必要です。
- .pylintrc
- pylintrc
- .pylintrc.toml
- pylintrc.toml
Semgrep
以下の設定ファイルのいずれかが必要です。
- semgrep.yml
- semgrep.yaml
- semgrep.config.yml
- semgrep.config.yaml
または、 .coderabbit.yaml にて reviews.tools.semgrep.config_file にて設定ファイルのパスを指定する必要があります。
reviews:
tools:
semgrep:
config_file: "/path/to/config.yaml"
Shopify CLI
.theme-check.yml または .theme-check.yaml という設定ファイルがプロジェクトルートに必要です。
smarty-lint
smartylint.js という設定ファイルが必要です。
SQLFluff
以下の設定ファイルのいずれかが必要です。
- setup.cfg
- tox.ini
- pep8.ini
- .sqlfluff
- pyproject.toml
または、 .coderabbit.yaml にて reviews.tools.sqlfluff.config_file にて設定ファイルのパスを指定する必要があります。
reviews:
tools:
sqlfluff:
config_file: "/path/to/config.toml"
まとめ
Linterは便利ですが、チームにフィットさせるためには設定が欠かせません。他のLintツールについてもオプションで設定が指定できますので、ぜひ利用しているプロジェクトに合わせた設定を行ってください。
CodeRabbit Documentation - AI code reviews on pull requests, IDE, and CLI