Skip to content

Rewrite the Quickstart as a tutorial. #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 117 additions & 33 deletions docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,139 @@
---
title: Playing with CodeRabbit
title: Quickstart
sidebar_label: Quickstart
description: Get started with CodeRabbit in less than 2 minutes
description: Get started with CodeRabbit in less than 15 minutes
sidebar_position: 1
---

# Quickstart Guide
# Quickstart

This tutorial gives you a hands-on demonstration of CodeRabbit, using a real, GitHub-based repository. It guides you through the following tasks:

1. Integrate CodeRabbit into a GitHub-based repository that you own.
1. Observe CodeRabbit perform a code review of a pull request that you initiate.
1. Converse with CodeRabbit about the code review.
1. Prompt CodeRabbit to generate its own improvements to the pull request.

When you complete this tutorial, you'll have seen CodeRabbit's code-review feature in action, and glimpsed a few of its other AI-driven abilities as well.

For a more general overview of CodeRabbit, see [Introduction](/).

:::note
Get started with CodeRabbit in three simple steps. No complex configuration needed.
While this tutorial focuses on GitHub, CodeRabbit also works with GitLab, Azure DevOps, and Bitbucket. For more information, see [Supported Git Platforms](/platforms/).
:::

## Steps to Enable CodeRabbit
## Before you begin

### Sign In with GitHub
Create a new, private repository on GitHub. Name the new repository `coderabbit-test`, and let it have otherwise default GitHub settings.

- Visit [coderabbit.ai](https://coderabbit.ai)
- Click "Sign in with GitHub"
- Authorize CodeRabbit
## Integrate CodeRabbit with your GitHub account

![CodeRabbit Login](/img/integrations/login-self-hosted-github.png)
To integrate CodeRabbit with your GitHub account, follow these steps:

### Add Your Repository
1. Visit [the CodeRabbit login page](https://app.coderabbit.ai/login).
1. Click **Login with GitHub**.
1. Click **Authorize coderabbitai**.

- Go to your [Dashboard](https://app.coderabbit.ai/dashboard)
- Click "Add Repositories"
- Select the repositories you want to enable
CodeRabbit takes a moment to set up the integration. After it finishes, the CodeRabbit dashboard appears.

![CodeRabbit Dashboard](/img/getting-started/dashboard-coderabbit.png)
## Add CodeRabbit to your repository

### You're Done 🎉
To add CodeRabbit to your test repository, follow these steps:

- CodeRabbit will automatically start reviewing your Pull Requests
- Default configuration works out of the box
- No additional setup needed
1. On the CodeRabbit dashboard, click **Add Repositories**. A GitHub repository-access dialog appears.
1. Select the **Only select repositories** radio button.
1. From the **Select repositories** menu, select the `coderabbit-test` repository that you created earlier in this Quickstart.
1. Click **Install & Authorize**.
1. If a CodeRabbit **Complete your signup** dialog appears, then fill it out with the requested information before continuing.

## What's Next?
CodeRabbit is now ready to use with your test repository. The next steps demonstrate its core code-review features.

- Watch CodeRabbit
- Here's an example of CodeRabbit in action:
![CodeRabbit PR Review Example](/img/getting-started/pr-examples.png)
- [View live example PR](https://github.com/tyaga001/devtoolsacademy/pull/39)
- [Configure CodeRabbit](/getting-started/configure-coderabbit) (optional)
- [Add custom review instructions](/guides/review-instructions) (optional)
## Let CodeRabbit perform a code review

## Need Help?
The following steps initiate a pull request to add a tiny and somewhat flawed Python library to your repository, triggering analysis and review from CodeRabbit.

- Join our [Discord community](https://discord.gg/coderabbit) for support
- Check out our [FAQ](/faq)
- Contact [[email protected]](mailto:[email protected])
Use your usual Git workflow to perform the following steps in the `coderabbit-test` repository:

:::tip
CodeRabbit starts working immediately. You can customize its behavior later when needed.
:::
1. Create a branch named `add-utils`.

1. In that new `add-utils` branch, create a new file called `simple_utils.py`, with the following content:

```
# simple_utils.py - A tiny utility library

def reverse_string(text):
"""Reverses the characters in a string."""
return text[::-1]

def count_words(sentence):
return len(sentence.split())

def celsius_to_fahrenheit(celsius):
return (celsius * 9/5) + 32
```
Comment on lines +61 to +73
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix hard tabs and specify code block language in code snippet.

The code block for simple_utils.py uses hard tabs for indentation, which is discouraged in markdown and flagged by markdownlint (MD010). Additionally, the code block does not specify a language, which is flagged by MD040. Replace hard tabs with spaces and specify python as the language for syntax highlighting.

Apply this diff to fix the issues:

-	```
-	# simple_utils.py - A tiny utility library
-
-	def reverse_string(text):
-			"""Reverses the characters in a string."""
-			return text[::-1]
-
-	def count_words(sentence):
-			return len(sentence.split())
-
-	def celsius_to_fahrenheit(celsius):
-			return (celsius * 9/5) + 32
-	```
+```python
+# simple_utils.py - A tiny utility library
+
+def reverse_string(text):
+    """Reverses the characters in a string."""
+    return text[::-1]
+
+def count_words(sentence):
+    return len(sentence.split())
+
+def celsius_to_fahrenheit(celsius):
+    return (celsius * 9/5) + 32
+```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

61-61: Hard tabs
Column: 1

(MD010, no-hard-tabs)


61-61: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


62-62: Hard tabs
Column: 1

(MD010, no-hard-tabs)


64-64: Hard tabs
Column: 1

(MD010, no-hard-tabs)


65-65: Hard tabs
Column: 1

(MD010, no-hard-tabs)


66-66: Hard tabs
Column: 1

(MD010, no-hard-tabs)


68-68: Hard tabs
Column: 1

(MD010, no-hard-tabs)


69-69: Hard tabs
Column: 1

(MD010, no-hard-tabs)


71-71: Hard tabs
Column: 1

(MD010, no-hard-tabs)


72-72: Hard tabs
Column: 1

(MD010, no-hard-tabs)


73-73: Hard tabs
Column: 1

(MD010, no-hard-tabs)


1. Commit the added file to the `add-utils` branch. Use any text you want for the commit message.

1. Create a pull request that proposes to merge the `add-utils` branch into the `main` branch. Use any text you want for the pull request message.

After a few moments, CodeRabbit responds to the pull request using the `@coderabbitai` GitHub account. It performs the following actions, all of which are visible on the pull request's page on GitHub:

* If you didn't write a pull request summary, then Code Rabbit adds a new summary to the pull request.

* CodeRabbit posts a comment titled **Walkthrough** containing analysis and commentary about the content of the pull request.

* CodeRabbit attaches a detailed code review to the pull request as another comment.

Part of the review resembles the following screenshot:

![An example code review comment](/img/getting-started/quickstart-comment.png)

This shows that CodeRabbit has noticed some flaws with this Python library, including a lack of docstrings and input validation. The review comment identifies these flaws, and suggests how you might implement them.

## Ask CodeRabbit for more information

After CodeRabbit reviews a pull request, you can converse with it about its review. You can also give CodeRabbit special commands to request it to perform specific functions, such as generating appropriate code changes for you.

1. Post the following as a new GitHub comment attached to the pull request:

```
@coderabbitai Why do all of these functions need docstrings? Isn't it obvious enough what they do?
```
Comment on lines +99 to +101
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix hard tabs and specify code block language in comment example.

The code block for the GitHub comment uses hard tabs and does not specify a language. Replace hard tabs with spaces and specify text as the language for clarity.

Apply this diff to fix the issues:

-	```
-	@coderabbitai Why do all of these functions need docstrings? Isn't it obvious enough what they do?
-	```
+```text
+@coderabbitai Why do all of these functions need docstrings? Isn't it obvious enough what they do?
+```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

99-99: Hard tabs
Column: 1

(MD010, no-hard-tabs)


99-99: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


100-100: Hard tabs
Column: 1

(MD010, no-hard-tabs)


101-101: Hard tabs
Column: 1

(MD010, no-hard-tabs)


After a few moments, CodeRabbit posts its reply, explaining its motivations for its recommendation. The reply might resemble the following:

> You're right that these functions are quite self-explanatory from their names alone. Docstrings aren't strictly necessary for every function, especially in smaller projects with clear function names.
>
> While docstrings do provide benefits (IDE tooltips, documentation generation, help for future developers), they can sometimes feel redundant for very straightforward functions. It's ultimately a matter of coding style and project requirements.
>
> If you prefer to skip docstrings for obvious utility functions in this project, that's perfectly reasonable. Would you like me to adjust my review approach regarding documentation for this repository?

In this case, CodeRabbit is offering to adjust its future behavior when reviewing changes to this repository. Instead, follow the next step to ask CodeRabbit to implement part of its suggestions.

1. Post the following as another new comment:

```
@coderabbitai generate docstrings
```
Comment on lines +115 to +117
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix hard tabs and specify code block language in command example.

The code block for the GitHub command uses hard tabs and does not specify a language. Replace hard tabs with spaces and specify text as the language for clarity.

Apply this diff to fix the issues:

-	```
-	@coderabbitai generate docstrings
-	```
+```text
+@coderabbitai generate docstrings
+```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

115-115: Hard tabs
Column: 1

(MD010, no-hard-tabs)


115-115: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


116-116: Hard tabs
Column: 1

(MD010, no-hard-tabs)


117-117: Hard tabs
Column: 1

(MD010, no-hard-tabs)


After a few moments, CodeRabbit does the following:

* CodeRabbit creates a new branch, based on `add-utils`.

* CodeRabbit commits changes to the branch that adds suggested docstrings to `add-utils`.

* CodeRabbit opens a new pull request between the new branch and `add-utils`.

## Clean up

Continue experimenting with CodeRabbit in your test repository for as long as you like. When you're finished, you can delete the repository.

You are now ready to add CodeRabbit to other repositories that you own, and let it review some real pull requests.

## What's next

- [Integrate CodeRabbit](http://localhost:3000/platforms/) with your repositories on GitHub, GitLab, Azure DevOps, or Bitbucket.
- [Configure CodeRabbit](/getting-started/configure-coderabbit) beyond its default settings.
- [Add custom review instructions](/guides/review-instructions).
- [Get support for CodeRabbit](/getting-started/support).
- [Learn more about how CodeRabbit works](/overview/why-coderabbit).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading