Initial configuration guide
This page provides a tour through a selection of key CodeRabbit configuration options.
For a general overview of how configuration in CodeRabbit works, see Configure CodeRabbit. For an exhaustive reference of all conifguration options, see Configuration reference.
How to use this guide
This guide walks you through several CodeRabbit configuration options that you can set in order to tune CodeRabbit code review behavior for your repositories.
Tthe default behavior and settings of CodeRabbit works for most repositories, in most situations. However, becoming familiar with the key settings described by this page can help you tune the behavior of CodeRabbit for the specific needs of your team. You can use this guide when initially setting up your organization and repositories with CodeRabbit, or you can return to it after using CodeRabbit for a while, when you feel ready to customize its behavior.
Each section in the guide links to specific entries in the configuration reference. These entries specify where in either the CodeRabbit web UI or your coderabbit.yaml
file to make the change.
If you are new to CodeRabbit, then the web UI is the easiest way to explore the available settings. Once you are more comfortable with the repository-level changes you want to make, we recommend adding coderabbit.yaml
files to those repositories.
General settings
These settings adjust overall CodeRabbit code review behavior.
Adjust code-review strictness
If you want CodeRabbit to apply a much stricter and more opinionated stance to its code reviews, then you can switch its profile setting from chill
to assertive
.
For more information, see Profile in the configuration reference.
Configure pull request approval
By default, CodeRabbit doesn't formally mark pull requests as approved after it informally reports approval in a code review. This leaves the job of formal pull request approval entirely up to human reviewers.
If you want to allow CodeRabbit to mark pull requests as approved, then you can enable the request changes workflow setting.
For more information, see Request Changes Workflow in the configuration reference.
Configure chat-based issue creation
You can ask CodeRabbit to create issues for you in the comments of a pull request that it's reviewing.
If you have integreated CodeRabbit with Jira or Linear, then you can tune this behavior a little more, restricting this feature to private repositories—the default setting—or disabling it entirely.
For more information, see Integrations in the configuration reference.
Configure learnings
You can teach CodeRabbit your team's review preferences by stating them in plain language during code reviews. CodeRabbit remembers these these prefrences, and applies them to subsequent code reveiws in the same repository.
If you don't want this feature, you can disable it. For more information, see Learnings in the configuration reference.
Data retention settings
These settings help you control how much data about your code that CodeRabbit retains. CodeRabbit temporarily stores information about your repositories in order to deliver perform faster and more tailored reviews, but you can opt of these features if your organization has stricter data-retention policies.
For more information about CodeRabbit data-retention policies, see Data privacy and security.
Enable or disable data retention globally
This setting is available only at the organization level, and not per-repository.
Your CodeRabbit organization has a data-retention setting which acts as a master-switch to all CodeRabbit features that require it to store its own data about your repositries. If you disable data retention, then none of your repositories can use knowledge base or caching features, even if you configure those repositories to enable them.
We recommend leaving this on. However, if your use of CodeRabbit requires strict data retention policy, then you can turn this off.
For more information, see Data retention in the configuration reference.
Configure cache use
By defualt, CodeRabbit keeps a temporary cache of data about your repository in order to make subsquent code reviews faster. If this conflicts with your organization's data-retention policies, you can disable this feature.
For more information, see Disable cache in the configuration reference.
Configure knowledge base retention
By defualt, CodeRabbit keeps a temporary cache of data about your repository in order to make subsquent code reviews faster. If this conflicts with your organization's data-retention policies, you can disable this feature.
For more information, see Disable cache in the configuration reference.
Tune the length of code reviews
By default, CodeRabbit writes thorough code reviews with several sub-sections. If you'd rather have CodeRabbit generated shorter reviews then you can change some of the following settings:
- Collapse walkthrough: wraps the detailed summary of proposed changes in collapsed-but-expandable container. (Off by default.)
- Changed files summary: lists of files affected by this pull request.
- Sequence diagrams: includes a visual diagram of object interactions.
- Assess linked issues: assesses how well the pull request addresses any linked issues/
- Related issues: lists issues found in your issue tracker that might be related to this pull request.
- Related pull requests: lists pull requests that might be related to this pull request.
- Suggested labels: Suggests labels for this pull request.
- Suggested reviewers: automatically suggest reviewers for PR
- Poem: generates a short poem about this pull request.
Adjust path-specific CodeRabbit behavior
These settings direct CodeRabbit to treat various files and and locations in your repository differently.
Add path filters
If your repository contains files or locations that CodeRabbit should disregard when preparing code reviews—or you want CodeRabbit to limit its consideration to only certain files—then you can define one or more path filters. Adding path filters to a large repository containing a lot of data, generated files, or other non-code content can let CodeRabbit work faster.
For more information, see Path filters in the CodeRabbit configuration reference.
Add general path instructions
By default, CodeRabbit applies the same review instructions and contexts to all of the pull requests that it generates, regardless of the files involved. If you want to apply additional review instructions to certain files or loations in your repository, then you can provide CodeRabbit with path instructions.
Each path instruction specifies a path specification and a set of instructions, the latter of which you express using natural language. For example, you can add a section like this to your repository's coderabbit.yaml
file:
path_instructions:
- path: `src/**/*.{ts,tsx,js}`
instructions:
- Review the React.js, TypeScript, JavaScript code for best practices
- Check for common security vulnerabilities such as:
- SQL Injection
- Insecure dependencies
- Sensitive data exposure
For more information, see Path instructions in the configuration reference.
Add documentation or unit-test path instructions
Similar to the general path instructions described by the previous section, you can define path-based instructions that
Set Automatic review behavior
By default, CodeRabbit automatically generates incremental code reviews for every new or updated pull request made against a repository's default branch. These settings listed in this section let you tune the behavior.
Configure incremental reviews
By default, the automatic code reviews that CodeRabbit generates are incremental, building on any previous reviews within the same pull request that CodeRabbit has already added.
We recommend leaving this feature enabled, for faster reviews that are easier to read. But, if you'd rather always see full code reviews by default, you can disable this feature.
For more information, see Automatic incremental review in the configuration reference.
Restrict automatic reviews to certain labels
If you want to be choosier about which pull requests CodeRabbit should automatically review, then you can restrict it to review only pull requests that you mark with certain labels.
For more information, see Labels in the configuration reference.
Automatically review more branches
If you want CodeRabbit to extend its automatic-review attention beyond the default branch of your repository—that is, main
or master
, usually—then you can give CodeRabbit a list of other branches that it is allowed to review.
For more information, see Branches in the configuration reference.
Configure tools
CodeRabbit has access to dozens of industry-standard open-source tools to help it perform its code reviews. These tools include a varity of linters, security analyzers, and other utilities. For a full list, see List of supported tools. CodeRabbit chooses which tools to apply to a given code review on a case-by-case basis.
By default, CodeRabbit considers every tool available to it during code reviews. If you want CodeRabbit to disregard certain tools, then you can disable them.
Several tools that CodeRabbit uses also allow you to specify a path to a tool-specific configuration file in your repository.
For more information, see Tools in the configuration reference.