Skip to content

Commit ee5a787

Browse files
authored
Add a new reference section for code guidelines. (coderabbitai#483)
1 parent 1d1d0f5 commit ee5a787

File tree

2 files changed

+110
-13
lines changed

2 files changed

+110
-13
lines changed

docs/integrations/knowledge-base.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,23 @@ Or you can comment directly on some lines of code in the PR. `@coderabbitai do n
1919

2020
For more information, see [Teach CodeRabbit your review preferences](/guides/learnings).
2121

22-
## Code Guidelines {#code_guidelines}
22+
## Code Guidelines {#code-guidelines}
2323

24-
CodeRabbit will analyse and learn from your organisation's code guidelines, which you can set up in the knowledge base section. These guidelines will then be used to conduct thorough code reviews.
24+
CodeRabbit can read _code guideline_ files that set standards and expectations about
25+
your team's coding practices, described in natural language. CodeRabbit applies any instructions it reads from a repository's code guideline files to all subsequent code reviews.
2526

26-
The following patterns are scanned by default.
27+
By default, CodeRabbit looks for and loads guideline files used by other AI coding assistants, including the following:
2728

28-
```text
29-
**/.cursorrules
30-
.github/copilot-instructions.md
31-
**/CLAUDE.md
32-
**/.cursor/rules/*
33-
**/.windsurfrules
34-
**/.clinerules/*
35-
**/.rules/*
36-
```
29+
- Claude Code
30+
- Cursor
31+
- Gemini
32+
- GitHub Copilot
33+
- Windsurf
3734

38-
![Illustration of code guidelines configuration](/img/knowledge-base/code-guidelines.png)
35+
You can also mark any other file
36+
or set of files in your repository as code guidelines by providing CodeRabbit with a list
37+
of paths to those files.
38+
39+
This feature is enabled by default; you can disable it if needed.
40+
41+
For more information about configuring the code guidelines feature, see [Code guidelines](/reference/configuration#code-guidelines) in the configuration reference page.

docs/reference/configuration.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,6 +1976,100 @@ Specify the Jira project keys to use for the knowledge base.
19761976

19771977
Specify the scope of learnings to use for the knowledge base. 'local' uses the repository's learnings, 'global' uses the organization's learnings, and 'auto' uses repository's learnings for public repositories and organization's learnings for private repositories.
19781978

1979+
### Code guidelines
1980+
1981+
You can define a list of paths that guide CodeRabbit to your organization's code guidelines.
1982+
If you do, then CodeRabbit applies these guidelines to its code reviews. For more
1983+
information, see [Code Guidelines](/integrations/knowledge-base#code_guidelines).
1984+
1985+
#### Enable code guidelines
1986+
1987+
<Tabs groupId="config-setting">
1988+
<TabItem value="web-ui" label="Web UI">
1989+
<table>
1990+
<tbody>
1991+
<tr>
1992+
<td><strong>Location</strong></td>
1993+
<td>Knowledge Base > Enabled</td>
1994+
</tr>
1995+
<tr>
1996+
<td><strong>Default</strong></td>
1997+
<td>true</td>
1998+
</tr>
1999+
</tbody></table>
2000+
</TabItem>
2001+
<TabItem value="yaml" label=".coderabbit.yaml" default>
2002+
<table>
2003+
<tbody>
2004+
<tr>
2005+
<td><strong>Field</strong></td>
2006+
<td>`knowledge_base.code_guidelines.enabled`</td>
2007+
</tr>
2008+
<tr>
2009+
<td><strong>Datatype</strong></td>
2010+
<td>boolean</td>
2011+
</tr>
2012+
<tr>
2013+
<td><strong>Default</strong></td>
2014+
<td>`true`</td>
2015+
</tr>
2016+
</tbody></table>
2017+
</TabItem>
2018+
</Tabs>
2019+
2020+
Enable CodeRabbit to enforce your organization's coding standards during reviews.
2021+
2022+
#### File patterns
2023+
2024+
<Tabs groupId="config-setting">
2025+
<TabItem value="web-ui" label="Web UI">
2026+
<table>
2027+
<tbody>
2028+
<tr>
2029+
<td><strong>Location</strong></td>
2030+
<td>Knowledge Base > File Patterns</td>
2031+
</tr>
2032+
<tr>
2033+
<td><strong>Default</strong></td>
2034+
<td>_No patterns_</td>
2035+
</tr>
2036+
</tbody></table>
2037+
</TabItem>
2038+
<TabItem value="yaml" label=".coderabbit.yaml" default>
2039+
<table>
2040+
<tbody>
2041+
<tr>
2042+
<td><strong>Field</strong></td>
2043+
<td>`knowledge_base.code_guidelines.filePatterns`</td>
2044+
</tr>
2045+
<tr>
2046+
<td><strong>Datatype</strong></td>
2047+
<td>array</td>
2048+
</tr>
2049+
<tr>
2050+
<td><strong>Default</strong></td>
2051+
<td>`[]`</td>
2052+
</tr>
2053+
</tbody></table>
2054+
</TabItem>
2055+
</Tabs>
2056+
2057+
A list of path specifications to your repository's coding guideline documents, relative
2058+
to the root of your repository. Fileglob matching is allowed. Paths are case-sensitive.
2059+
2060+
If the code guidelines feature is enabled, then CodeRabbit applies code-guideline
2061+
documents found at the following paths, in addition to any paths that you define:
2062+
2063+
- `**/.cursorrules`
2064+
- `.github/copilot-instructions.md`
2065+
- `**/CLAUDE.md`
2066+
- `**/GEMINI.md`
2067+
- `**/.cursor/rules/*`
2068+
- `**/.windsurfrules`
2069+
- `**/.clinerules/*`
2070+
- `**/.rules/*`
2071+
- `**/AGENT.md`
2072+
19792073
### Linear
19802074

19812075
#### Enable Linear

0 commit comments

Comments
 (0)