Skip to content

Commit fc4ac62

Browse files
Update the ast-grep documentation to include the coderabbit config file changes
1 parent f1eaec1 commit fc4ac62

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

docs/integrations/ast-grep.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,20 @@ This documentation provides guidance on integrating AST-Grep rules within the Co
2727
### **Setting up AST-Grep rules**
2828
By default, users can add AST-Grep rules by following these steps:
2929

30-
1. Create a folder named `rules` in your project directory.
31-
2. Add individual `.yaml` files for each AST-Grep rule within the `rules` folder.
30+
1. Create a folder that keeps all the `custom-name` in your project directory.
31+
2. Add individual `.yaml` files for each AST-Grep rule within the `custom-name` folder.
3232
3. Ensure each `.yaml` file contains the necessary AST-Grep rule configurations.
3333
4. Ensure that all rules contains a `message` property, that is going to be used on the review process.
34+
5. Add the `custom-name` folder to the `.code-rabbit.yml` file under `tools.ast_grep` configuration.
35+
```yaml
36+
#...
37+
reviews:
38+
#...
39+
tools:
40+
ast_grep:
41+
rules_folder: "custom-name"
42+
#...
43+
```
3444

3545
### **The rule object**
3646

@@ -159,6 +169,19 @@ my-awesome-project # project root
159169
| |- is-literal.yml
160170
```
161171

172+
>Also, you need to add the `rules` and `utils` folders to the `.code-rabbit.yml` file under `tools.ast_grep` configuration.
173+
174+
```yaml
175+
#...
176+
reviews:
177+
#...
178+
tools:
179+
ast_grep:
180+
rules_folder: "rules"
181+
utils_folder: "utils"
182+
#...
183+
```
184+
162185
```yaml
163186
# is-literal.yml
164187
id: is-literal

0 commit comments

Comments
 (0)