Skip to content

Move ast-grep documentation under the prompt-customization page #24

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

Merged
merged 3 commits into from
Mar 13, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Change ast-grep naming
  • Loading branch information
petrisorcoderabbit committed Mar 13, 2024
commit e1f7366450dc68b17c667ff0d9059b01ff9f48ea
16 changes: 8 additions & 8 deletions docs/guides/prompt-customization.md
Original file line number Diff line number Diff line change
@@ -52,17 +52,17 @@ Descriptive test names are used to clearly convey the intent of each test.
## Abstract Syntax Tree (AST) instructions

:::note
**Deep dive into AST patterns and AST-Grep rules**
**Deep dive into AST patterns and ast-grep rules**
- AST patterns [wikipedia](https://en.wikipedia.org/wiki/Abstract_syntax_tree)
- AST-grep [official documentation](https://ast-grep.github.io/guide/rule-config.html) for detailed guides.
- ast-grep [official documentation](https://ast-grep.github.io/guide/rule-config.html) for detailed guides.
:::

This section explains how to add custom code review instructions using AST-Grep rules. AST-Grep is a tool used for searching code using abstract syntax trees (AST) patterns.
This section explains how to add custom code review instructions using ast-grep rules. ast-grep is a tool used for searching code using abstract syntax trees (AST) patterns.

By default, you can add AST-Grep rules by following these steps:
By default, you can add ast-grep rules by following these steps:
1. Create a folder that keeps all the ast-grep rules in your project directory.
2. Add individual `.yaml` files for each AST-Grep rule within the newly created folder.
3. Ensure that each `.yaml` file contains the necessary AST-Grep rule configurations.
2. Add individual `.yaml` files for each ast-grep rule within the newly created folder.
3. Ensure that each `.yaml` file contains the necessary ast-grep rule configurations.
4. Ensure that all rules contains a `message` property, that will be used in the review process.
5. Add the rules folder to the `.coderabbit.yml` file under `tools.ast-grep` configuration.

@@ -236,7 +236,7 @@ rule:

### Multiple Languages Support

CodeRabbit supports multiple programming languages for defining AST-Grep rules.
CodeRabbit supports multiple programming languages for defining ast-grep rules.

- JavaScript
- Typescript
@@ -248,7 +248,7 @@ CodeRabbit supports multiple programming languages for defining AST-Grep rules.
- Python
- C

Below are examples of AST-Grep rules in different languages:
Below are examples of ast-grep rules in different languages:

#### JavaScript
**Importing files without an extension is not allowed**