Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d01fee9

Browse files
authored
Expand and refactor the code-review docs (#355)
* Split the current chat commands page into three pages: a reference page, a troubleshooting guide, and a best practices guide. Replace the chat commands page with two task-orience how-to guides, one about controlling code reviews, and one about generating improvements. Add a new overview page for the code review process.
1 parent e2e3084 commit d01fee9

7 files changed

+422
-60
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Code review best practices
3+
description: Best practices for managing CodeRabbit code reviews.
4+
sidebar_label: Best practices
5+
---
6+
7+
This page lists best practices for performing code reviews with CodeRabbit.
8+
9+
For more information about working with
10+
CodeRabbit through chat, see [Control and manage code reviews](/guides/commands).
11+
12+
For a CodeRabbit command reference, see [Code review command reference](/reference/review-commands).
13+
14+
## Recommended code-review workflow
15+
16+
- Start with `@coderabbitai review` for checking new changes.
17+
- Use `@coderabbitai full review` when major changes require a fresh perspective.
18+
- Generate summaries after significant updates using `@coderabbitai summary`.
19+
20+
## Managing large changes
21+
22+
- Use `@coderabbitai pause` before making multiple commits.
23+
- Resume reviews with `@coderabbitai resume` when ready.
24+
- Consider `@coderabbitai full review` after substantial changes.
25+
26+
## Documentation flow
27+
28+
- Run `@coderabbitai generate docstrings` after finalizing function implementations.
29+
- Learn more about [docstring generation](/finishing-touches/docstrings).
30+
31+
## Overall tips
32+
33+
- Commands are case-insensitive (`@coderabbitai REVIEW` works the same as `@coderabbitai review`).
34+
- Commands can be issued by anyone with write access to the repository.
35+
- Multiple commands can be used in sequence as needed.
36+
- Use `@coderabbitai configuration` to export your settings before making changes.
37+
38+
## Command response time
39+
40+
- Most commands (pause, resume, ignore) take effect immediately.
41+
- Review commands typically complete within a few minutes, depending on PR size.
42+
- Docstring generation time varies based on the number of functions.

docs/guides/code-review-overview.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: Review pull requests
3+
description: An overview of CodeRabbit's core code review features.
4+
sidebar_label: Overview
5+
---
6+
7+
The central feature of CodeRabbit is its ability to proactively review
8+
new pull requests on your code repository.
9+
10+
CodeRabbit reviews take the form of pull request comments that
11+
include summaries, analyses, and initial critiques of the proposed changes.
12+
This information, usually added to pull requests within minutes, can help your team perform more rapid, better-informed code reviews.
13+
14+
The following sections present an overview of this feature. For a hands-on example that lets you experience a CodeRabbit code review using
15+
a real repository, see [Quickstart](/getting-started/quickstart).
16+
17+
## Automatically review pull requests {#review}
18+
19+
After you [integrate CodeRabbit with your repository](/platforms), CodeRabbit proceeds
20+
to automatically review every subsequent pull request, as soon as each one is created.
21+
22+
CodeRabbit performs code reviews by attaching comments to the pull request.
23+
These comments contain detailed summaries and analyses of the changes,
24+
as well as listing out problems or areas for potential improvement that it found.
25+
26+
CodeRabbit uses [a variety of open-source linters and security tools](/tools) and a custom
27+
code verification agent to provide this analysis. CodeRabbit
28+
also consults several models to further analyze and critique the proposed changes,
29+
using all of the content of your repository as context. The code-review comment that CodeRabbit attaches
30+
to your pull request synthesizes and summarizes all of the information collected from these different sources.
31+
32+
For more information about the graph analysis that CodeRabbit includes with its reviews
33+
when available, see [CodeRabbit Code Graph Analysis](/integrations/code-graph-analysis).
34+
35+
### Events that trigger automated reviews {#events}
36+
37+
By default, the following activity in your repository triggers CodeRabbit to
38+
perform a code review:
39+
40+
- If CodeRabbit sees a new pull request, then it immediately performs a full review
41+
of the proposed code changes.
42+
- If an open pull request that CodeRabbit has already reviewed gets modified with another
43+
commit, then CodeRabbit performs an incremental review that focuses on the new commit.
44+
45+
## Interact with CodeRabbit reviews {#interact}
46+
47+
After CodeRabbit attaches its initial code-review comment to a pull request, you can
48+
directly interact with CodeRabbit by mentioning its username, `@coderabbitai`, in comments
49+
that you post to the pull request.
50+
51+
These interactions can serve several purposes:
52+
53+
- Free-form discussion about the pull request and the ongoing code review.
54+
- Commands to have CodeRabbit perform specific actions regarding the code review.
55+
- Prompts to have CodeRabbit generate its own improvements to the branch under review.
56+
57+
### Chat with CodeRabbit {#chat}
58+
59+
You can have open-ended, natural-language discussion with CodeRabbit during a code review, treating it
60+
as an LLM-powered chatbot that has your entire code repository available for context. For more information, see [CodeRabbit Chat](/guides/agent_chat).
61+
62+
### Manage CodeRabbit review behavior {#manage}
63+
64+
CodeRabbit recognizes a variety of keyword-based commands that let you control its
65+
behavior during a code review, including the following:
66+
67+
- Pause or resume automated reviews of the pull request.
68+
- Manually request a review, when automated reviews are paused.
69+
- Resolve all open comments authored by CodeRabbit.
70+
71+
For more information, see [Control and manage code reviews](/guides/commands).
72+
73+
### Generate improvements {#generate}
74+
75+
You can command CodeRabbit to generate improvements to the branch under review.
76+
CodeRabbit accomplishes this by publishing a new branch based on the branch under review,
77+
and creating a new pull request for your own review.
78+
79+
Available code-generation commands let you request the following from CodeRabbit:
80+
81+
- Implement the suggestions for improvements that CodeRabbit has made in its earlier code review comments.
82+
- Generate inline documentation for any undocumented functions that this pull request proposes to add.
83+
84+
For more information, see [Generate improvements](/guides/generate-improvements).
85+
86+
## What's next {#whats-next}
87+
88+
- [Control and manage code reviews](/guides/commands)
89+
- [Generate code improvements](/guides/generate-improvements)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Code review troubleshooting
3+
description: Troubleshooting CodeRabbit code reviews.
4+
sidebar_label: Troubleshooting
5+
---
6+
7+
This page is about troubleshooting interactive code review sessions with CodeRabbit. For more information about working with
8+
CodeRabbit through chat, see [Control and manage code reviews](/guides/commands).
9+
10+
If a CodeRabbit command doesn't seem to work:
11+
12+
1. Check that you have the necessary repository permissions.
13+
2. Verify the command syntax.
14+
3. Look for any response from CodeRabbit in the PR comments.
15+
4. Use `@coderabbitai help` for command guidance.
16+
17+
Need help? Join our community on [Discord](https://discord.gg/coderabbit) or [contact our support team](/getting-started/support).

docs/guides/commands.md

Lines changed: 120 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,92 +3,152 @@ title: Control and manage code reviews
33
description: Learn how to control CodeRabbit using commands in pull request comments
44
---
55

6-
# CodeRabbit Commands
6+
This page is about issuing direct commands to CodeRabbit during code reviews.
7+
For a general overview of performing code reviews with CodeRabbit, see [Review pull requests](/guides/code-review-overview).
78

8-
> Control your code reviews directly from pull request comments using CodeRabbit's command system. Each command starts with `@coderabbitai` followed by the specific action you want to take.
9+
You can control CodeRabbit's behavior with a specific pull request by mentioning the
10+
username of its bot, `@coderabbitai`, alongside keywords in comments or the pull
11+
request description, as specified by the next sections of this page.
912

10-
## Review Control Commands
13+
For a complete CodeRabbit command reference, see [Code review command reference](/reference/review-commands).
1114

12-
### Managing Reviews
15+
## Control automatic code reviews {#flow}
1316

14-
| Command | Description | Use Case |
15-
| --------------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------- |
16-
| `@coderabbitai review` | Triggers an incremental review of new changes | When automatic reviews are disabled or you want to manually trigger a review |
17-
| `@coderabbitai full review` | Performs a complete review of all files from scratch | When you want to get fresh insights on the entire PR |
18-
| `@coderabbitai summary` | Regenerates the PR summary | When you want an updated overview after making changes |
17+
By default, CodeRabbit automatically reviews every new pull request created in
18+
your repository. It updates its review with comments whenever the pull request has new commits
19+
pushed to it.
1920

20-
### Review Flow Control
21+
The following sections show you how to tell CodeRabbit to modify this behavior with
22+
a specific pull request, such as pausing reviews, or resolving open comments.
2123

22-
| Command | Description | Use Case |
23-
| ---------------------- | ---------------------------------------- | --------------------------------------------------- |
24-
| `@coderabbitai pause` | Temporarily stops reviews on the PR | When you're making multiple rapid changes |
25-
| `@coderabbitai resume` | Restarts reviews after a pause | When you're ready for CodeRabbit to review again |
26-
| `@coderabbitai ignore` | Permanently disables reviews for this PR | When you want to handle the review process manually |
24+
For more information about permanently configuring the behavior of CodeRabbit on
25+
your repository, see [Add a configuration file](/getting-started/configure-coderabbit).
2726

28-
### Comment Management
27+
### Pause and resume automatic code reviews {#pause-resume}
2928

30-
| Command | Description | Use Case |
31-
| ----------------------- | --------------------------------------- | ------------------------------------------------------- |
32-
| `@coderabbitai resolve` | Resolves all CodeRabbit review comments | When you've addressed all feedback and want to clean up |
29+
You can tell CodeRabbit to pause its automatic reviews of a pull request. If
30+
you do, then you can still manually request CodeRabbit to review changes using
31+
the commands listed on [Code review command reference](/reference/review-commands).
3332

34-
### Documentation Commands
33+
To pause automated reviews of a pull request, post the following comment to the
34+
pull request:
3535

36-
| Command | Description | Use Case |
37-
| ----------------------------------- | -------------------------------------------- | --------------------------------------------------- |
38-
| `@coderabbitai generate docstrings` | Generates docstrings for functions in the PR | When you need automatic documentation for your code |
39-
| `@coderabbitai configuration` | Shows current CodeRabbit settings | When you need to check or export your configuration |
36+
```text
37+
@coderabbitai pause
38+
```
4039

41-
### Agentic Chat Commands
40+
To resume automated reviews after pausing them, post the following comment to the
41+
pull request:
4242

43-
| Command | Description | Use Case |
44-
| -------------------- | ---------------------------------------------------------- | ---------------------------------------------------- |
45-
| `@coderabbitai plan` | Get the agentic chat to plan an edit for previous comments | When you want CodeRabbit to change your code for you |
43+
```text
44+
@coderabbitai resume
45+
```
4646

47-
### Help & Support
47+
### Disable automatic code reviews {#ignore}
4848

49-
| Command | Description | Use Case |
50-
| -------------------- | ------------------------------------------ | ------------------------------------------ |
51-
| `@coderabbitai help` | Displays available commands and usage info | When you need guidance on using CodeRabbit |
49+
To disable automatic code reviews for a pull request, add the following line
50+
anywhere in the pull request description:
5251

53-
## Best Practices
52+
```text
53+
@coderabbitai ignore
54+
```
5455

55-
### Review Workflow
56+
As long as that text remains in the description, CodeRabbit will not
57+
automatically review any commits associated with that pull request.
58+
You can still [chat with CodeRabbit](/guides/agent_chat) and issue other commands in the pull
59+
request comments.
5660

57-
- Start with `@coderabbitai review` for checking new changes
58-
- Use `@coderabbitai full review` when major changes require a fresh perspective
59-
- Generate summaries after significant updates using `@coderabbitai summary`
61+
To enable automatic reviews on that pull request, delete "`@coderabbitai ignore`"
62+
from the pull request description. CodeRabbit commences automatic reviews starting with
63+
the next commit made to the branch under review.
6064

61-
### Managing Large Changes
65+
## Manually request code reviews {#request}
6266

63-
- Use `@coderabbitai pause` before making multiple commits
64-
- Resume reviews with `@coderabbitai resume` when ready
65-
- Consider `@coderabbitai full review` after substantial changes
67+
You can ask CodeRabbit to perform a code review at any time. This can be useful
68+
when you have paused automated code reviews. Manually requested reviews have
69+
two types:
6670

67-
### Documentation Flow
71+
- A _full review_ disregards any comments that CodeRabbit has already made
72+
on this pull request, and generates a complete review of the entire pull request.
6873

69-
- Run `@coderabbitai generate docstrings` after finalizing function implementations
70-
- Learn more about [docstring generation](/finishing-touches/docstrings)
74+
- An _incremental review_ takes all comments that CodeRabbit has made since its most recent full review into consideration, and generates a review of only the new changes.
7175

72-
## Tips
76+
To manually request a full review, post the following comment to the
77+
pull request:
7378

74-
- Commands are case-insensitive (`@coderabbitai REVIEW` works the same as `@coderabbitai review`)
75-
- Commands can be issued by anyone with write access to the repository
76-
- Multiple commands can be used in sequence as needed
77-
- Use `@coderabbitai configuration` to export your settings before making changes
79+
```text
80+
@coderabbitai full review
81+
```
7882

79-
## Command Response Time
83+
To manually request an incremental review, post the following comment to the
84+
pull request:
8085

81-
- Most commands (pause, resume, ignore) take effect immediately
82-
- Review commands typically complete within a few minutes, depending on PR size
83-
- Docstring generation time varies based on the number of functions
86+
```text
87+
@coderabbitai review
88+
```
8489

85-
## Troubleshooting
90+
## Resolve comments {#resolve}
8691

87-
If a command doesn't seem to work:
92+
To have CodeRabbit mark all of its previous comments as resolved, post the following comment to the
93+
pull request:
8894

89-
1. Check that you have the necessary repository permissions
90-
2. Verify the command syntax
91-
3. Look for any response from CodeRabbit in the PR comments
92-
4. Use `@coderabbitai help` for command guidance
95+
```text
96+
@coderabbitai resolve
97+
```
9398

94-
Need help? Join our community on [Discord](https://discord.gg/coderabbit) or contact our support team.
99+
## Update information about the pull request {#update}
100+
101+
The commands in this section request CodeRabbit to generate and post updated information
102+
about the pull request itself.
103+
104+
### Update the summary text {#summary}
105+
106+
To have CodeRabbit update the generated summary of the branch’s proposed changes
107+
to the pull request’s description, post the following comment:
108+
109+
```text
110+
@coderabbitai summary
111+
```
112+
113+
CodeRabbit updates the summary text to the description under the heading
114+
"Summary by CodeRabbit".
115+
116+
### Diagram the pull request history {#diagram}
117+
118+
To have CodeRabbit post a comment that contains a sequence diagram which visualizes the
119+
history of the pull request under review, post the following comment:
120+
121+
```text
122+
@coderabbitai generate sequence diagram
123+
```
124+
125+
## Get information about CodeRabbit {#info}
126+
127+
The commands in this section request CodeRabbit to display its own configuration
128+
or documentation.
129+
130+
### Display current configuration {#config}
131+
132+
To have CodeRabbit post a comment listing out its current configuration
133+
with your repository, post the following comment to the
134+
pull request:
135+
136+
```text
137+
@coderabbitai configuration
138+
```
139+
140+
### Display a quick-reference guide {#help}
141+
142+
To have CodeRabbit post a comment to the pull request with a quick-reference
143+
guide to its own commands and other features, post the following comment to the
144+
pull request:
145+
146+
```text
147+
@coderabbitai help
148+
```
149+
150+
## What's next {#whats-next}
151+
152+
- [Generate code improvements](/guides/generate-improvements)
153+
- [Best practices](/guides/code-review-best-practices)
154+
- [Troubleshooting](/guides/code-review-troubleshooting)

0 commit comments

Comments
 (0)