Configure CodeRabbit
CodeRabbit offers various configuration options to tailor the reviews to your requirements. Configuration can be made using one of the below options :
- Configure using CodeRabbit YAML File (Recommended)
- Configure using CodeRabbit UI
Configuration defined in the YAML file overrides the settings in the UI.
1. Configure CodeRabbit using a YAML File
You can add a .coderabbit.yaml
configuration file to the root of your
repositories. Below is a sample YAML file that can be used as a starting point
and changed as needed:
version 2: Current
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: "en-US"
early_access: false
reviews:
request_changes_workflow: false
high_level_summary: true
poem: true
review_status: true
collapse_walkthrough: false
auto_review:
enabled: true
ignore_title_keywords:
- "WIP"
- "DO NOT MERGE"
drafts: false
chat:
auto_reply: true
YAML settings:
-
language
: Set the language for reviews using the ISO language code. For example,"ja"
configures reviews in Japanese. -
tone_instructions
: Set the tone for the reviews and the chat. Example: 'You must use talk like Mr. T. I pity the fool who doesn't!' -
early_access
: Enroll in the early access program to take advantage of forthcoming features before their general release (default:false
). -
reviews
: Configurations for the code reviews.-
request_changes_workflow
: Enable request changes review workflow for CodeRabbit reviews. (default:false
). -
high_level_summary
: CodeRabbit generates a high-level summary of the changes (default:true
). -
poem
: Indicates whether a creative poem should be included in the review (default:true
). -
review_status
: Indicates the status of the review (default:true
). -
collapse_walkthrough
: Collapses the walkthrough comment (default:false
). -
path_filters
: Specifies file patterns to exclude or include for a review, such as!dist/**
andsrc/**.tsx
, using glob notation. Example:path_filters:
- !**/*.xml
- !**/generated/** -
path_instructions
: Provides specific additional guidelines for code review based on file paths. In the given example, JavaScript files are singled out for checks against the Google JavaScript style guide. File path accepts glob pattern. Example:path_instructions:
- path: "**/*.js"
instructions:
"Review the JavaScript code for conformity with the Google JavaScript
style guide, highlighting any deviations."
- path: "tests/**/*"
instructions:
"Assess the unit test code employing the Mocha testing framework.
Test descriptions must be sufficiently detailed to clarify the
purpose of each test." -
auto_review
: Manages settings for automated code reviews, such as:enabled
: Automated code review (default:true
).ignore_title_keywords
: Review will be ignored if a pull request title contains one of the list of keywords (case-insensitive). Example:"WIP"
,"DO NOT MERGE"
.labels
: Review will be triggered if a pull request matches one of the list of labels (case-insensitive).drafts
: Determines whether draft pull requests are reviewed (default:true
).base_branches
: A list of base branches for which the reviews will trigger, apart from the default branch. Accepts regex pattern. Example:
base_branches:
- "develop"
- "feat/.*" -
tools
: Configurations for the tools used in the review.-
ast-grep
: Configurations for theast-grep
tool.rule_dirs
: The directory name where the customast-grep
rules are stored.util_dirs
: The directory name where the customast-grep
utils are stored.packages
: A package allows you to share rules across multiple projects. Essentially, a package is a collection ofast-grep
rules.
-
github-checks
: Configuration for GitHub Checks integration.enabled
: Enable integration, defaults to true.timeout_ms
: Time in milliseconds to wait for all GitHub Checks to conclude, defaults to 90000 (1.5 minutes), maximum is 300000 (5 minutes), minimum is 0 (no timeout).
-
markdownlint
: Configuration formarkdownlint
integration.enabled
: Enable integration, defaults to true.
-
ruff
: Configuration forruff
integration.enabled
: Enable integration, defaults to true.
-
shellcheck
: Configuration forshellcheck
integration.enabled
: Enable integration, defaults to true.
-
languagetool
: Configuration forlanguagetool
integration.enabled
: Enable integration, defaults to true.level
: The level of the rule. Can be onedefault
orpicky
. If set topicky
, additional rules will be activated, i.e. rules that you might only find useful when checking formal text.enabled_rules
: IDs of rules to be enabled. The rule won't run unless 'level' is set to a level that activates the rule.disabled_rules
: IDs of rules to be disabled.enabled_categories
: IDs of categories to be enabled.disabled_categories
: IDs of categories to be disabled.enabled_only
: Only the rules and categories whose IDs are specified withenabled_rules
orenabled_categories
are enabled.
ast-grep:
rule_dirs:
- "rules"
util_dirs:
- "utils"
packages:
- "ast-grep-essentials"
- "my-awesome-org/my-awesome-package" # public GitHub repository that contains ast-grep rules
github-checks:
enabled: true
timeout_ms: 90000
markdownlint:
enabled: true
ruff:
enabled: true
shellcheck:
enabled: true
languagetool:
enabled: true
enabled_only: false
level: default
enabled_categories:
- "TON_ACADEMIC"
- "CASING"
-
-
-
chat
: Defines the behavior of CodeRabbit's bot in conversations.auto_reply
: The bot automatically replies without the need of the user tagging it (default:true
).
Refer: CodeRabbit Configuration Schema.
version 1 (deprecated)
Version 1: deprecated
(Please use version version 2)
settings:
# Enables automatic reviewing of draft pull requests.
enable_draft_pr_reviews: true
# Specifies additional base/target branches to be reviewed. Accept regex pattern.
additional_branches_to_be_reviewed:
- "master"
- "yaml/test"
# Disables generation of release notes.
disable_high_level_summary: false
# Specific review instructions for certain file paths. File paths accept glob pattern
path_based_instructions:
- path: "**/*.js"
instructions:
"Review the JavaScript code against the Google JavaScript style guide
and point out any mismatches"
- path: "tests/**/*"
instructions:
"Review the following unit test code written using the Mocha test
library. Ensure that: - The code adheres to best practices associated
with Mocha. - Descriptive test names are used to clearly convey the
intent of each test."
# Comma separated list of keywords in the title that should be ignored.
ignored_pr_titles: "WIP"
# ISO Code for the review language.
review_language: "en"
# Disables review and other status comments.
disable_review_status: false
# Add walkthrough comment in a collapsible section.
collapse_walkthrough_comment: true
# Disable automatic code reviews for this repository.
disable_review: false
# External tools configurations
This configuration file consists of the following settings:
enable_draft_pr_reviews
: Set tofalse
to disable draft pull request(PR) reviews.additional_branches_to_be_reviewed
: Define additional branches to be reviewed besides the default branch.disable_high_level_summary
: If set totrue
, disables high-level summary generation.path_based_instructions
: Allows you to specify instructions based on file paths. In this example, instructions for Python and JavaScript files are provided, encouraging adherence to the Google style guide.ignored_pr_titles
: Specifies ignored PR titles, in this case, "WIP" (Work in Progress).review_language
: Sets the review language to French (fr
).disable_poem
: If set tofalse
, enables the "poem" feature.early_access_program
: Determines whether to enable the early access program (set tofalse
in this case).exclude_file_patterns
: Specifies patterns for excluding certain files from review, such as!dist/**
and!**.md
.limit_reviews_by_label
: Limits reviews by label, targeting "first_bug" label reviews.disable_review
: Totally disables automatic code reviews for the repository.disable_review_status
: This is the comment posted for each incremental review status. This removes the review status comment. Reviews will still take place. However, optional comments added to the review status will not be posted.collapse_walkthrough_comment
: Specifies whether to collapse walkthrough comments on the review.
2. Configure CodeRabbit through the UI
Reviews can also be configured through the UI under repository settings:
Review Configuration
Path-based instructions : Provide additional review guidelines based on the file paths using glob patterns.
For further guidance, please refer to this section Review Instructions.
Language Selection: Select the natural language in which you want the review feedback. CodeRabbit supports most of the widely used languages. The default language is English.
Disable High-Level Summary: This allows disabling the high-level summary added with the pull request description.
Review Filters
Disable Reviews: Disables automatic code reviews for the repository. Reviews can be initiated on-demand using CodeRabbit commands.
Enable draft pull request reviews: Select whether CodeRabbit should review the draft pull requests.
Configure reviews using pull request labels: Select specific pull request labels for which reviews should occur.
File Pattern: Include or exclude specific file patterns from the review.
Please note that code reviews commence with new pull requests or incremental commits to existing pull requests once the CodeRabbit app is installed. Should you have any questions or require assistance, our support team is here to help.