This page describes how you can configure the code-review behavior of CodeRabbit using natural-language chat.
.coderabbit.yaml
files. Learnings give you a convenient way to quickly set or correct the behavior of CodeRabbit in ways that are highly specific to your team’s coding style, or in ways that the CodeRabbit configuration options don’t otherwise account for.
You can review and edit your organization’s CodeRabbit learnings at any time, as detailed later in this page.
Consider using nested try-catch blocks here to handle different error scenarios more comprehensively.If this critique disagrees with your team’s coding practices specific to try-catch blocks, then you can reply to this CodeRabbit using a comment of your own, addressed to the
@coderabbitai
service account on GitHub:
@coderabbitai Actually, we’ve found that nested try-catch blocks make our auth middleware harder to debug in production. We prefer early returns with specific error codes - it’s cleaner and our monitoring tools can track them better.CodeRabbit considers your reply, and decides to make a learning out of it. It acknowledges this in another reply:
You’re absolutely right about the debugging benefits. Early returns with specific error codes do provide better clarity and monitoring capabilities. I’ll remember this preference for your authentication middleware. Thank you for the guidance!CodeRabbit also adds a Learnings added section to this comment, making explicit the fact that this chat has modified its future behavior with your team. CodeRabbit then creates a new learnings record for itself. Along with metadata such as the pull request number, filename, and GitHub user associated with the learning, CodeRabbit adds this self-instructive text to the new record:
In authentication middleware, prefer returning early with specific error codes rather than nested try-catch blocks. This improves readability and makes error tracking easier in production environments.
error reporting
into Similarity search and set Top K to 10
.
To filter the displayed learnings by repository, user, or file path, click + Filters, and select additional criteria.
auto
: When reviewing a public repository, CodeRabbit applies only the learnings specific to that repository. When reviewing private repository, CodeRabbit applies all of your organization’s learnings. This is the default setting.global
: CodeRabbit applies all of your organization’s learnings to all code reviews.local
: CodeRabbit applies only learnings associated with code reviews’ respective repositories.