diff --git a/docs/integrations/knowledge-base.md b/docs/integrations/knowledge-base.md index 9cdedc80..24b2d1be 100644 --- a/docs/integrations/knowledge-base.md +++ b/docs/integrations/knowledge-base.md @@ -19,20 +19,23 @@ Or you can comment directly on some lines of code in the PR. `@coderabbitai do n For more information, see [Teach CodeRabbit your review preferences](/guides/learnings). -## Code Guidelines {#code_guidelines} +## Code Guidelines {#code-guidelines} -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. +CodeRabbit can read _code guideline_ files that set standards and expectations about +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. -The following patterns are scanned by default. +By default, CodeRabbit looks for and loads guideline files used by other AI coding assistants, including the following: -```text -**/.cursorrules -.github/copilot-instructions.md -**/CLAUDE.md -**/.cursor/rules/* -**/.windsurfrules -**/.clinerules/* -**/.rules/* -``` +- Claude Code +- Cursor +- Gemini +- GitHub Copilot +- Windsurf -![Illustration of code guidelines configuration](/img/knowledge-base/code-guidelines.png) +You can also mark any other file +or set of files in your repository as code guidelines by providing CodeRabbit with a list +of paths to those files. + +This feature is enabled by default; you can disable it if needed. + +For more information about configuring the code guidelines feature, see [Code guidelines](/reference/configuration#code-guidelines) in the configuration reference page. diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index eb070e23..d95fbaa0 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -1976,6 +1976,100 @@ Specify the Jira project keys to use for the knowledge base. 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. +### Code guidelines + +You can define a list of paths that guide CodeRabbit to your organization's code guidelines. +If you do, then CodeRabbit applies these guidelines to its code reviews. For more +information, see [Code Guidelines](/integrations/knowledge-base#code_guidelines). + +#### Enable code guidelines + + + + + + + + + + + + + +
LocationKnowledge Base > Enabled
Defaulttrue
+
+ + + + + + + + + + + + + + + +
Field`knowledge_base.code_guidelines.enabled`
Datatypeboolean
Default`true`
+
+
+ +Enable CodeRabbit to enforce your organization's coding standards during reviews. + +#### File patterns + + + + + + + + + + + + + +
LocationKnowledge Base > File Patterns
Default_No patterns_
+
+ + + + + + + + + + + + + + + +
Field`knowledge_base.code_guidelines.filePatterns`
Datatypearray
Default`[]`
+
+
+ +A list of path specifications to your repository's coding guideline documents, relative +to the root of your repository. Fileglob matching is allowed. Paths are case-sensitive. + +If the code guidelines feature is enabled, then CodeRabbit applies code-guideline +documents found at the following paths, in addition to any paths that you define: + +- `**/.cursorrules` +- `.github/copilot-instructions.md` +- `**/CLAUDE.md` +- `**/GEMINI.md` +- `**/.cursor/rules/*` +- `**/.windsurfrules` +- `**/.clinerules/*` +- `**/.rules/*` +- `**/AGENT.md` + ### Linear #### Enable Linear