Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1b14bb0

Browse files
harjotgilltyaga001
authored andcommittedOct 16, 2024
use directory instead of folder terminology
1 parent 05a1cf1 commit 1b14bb0

File tree

2 files changed

+112
-106
lines changed

2 files changed

+112
-106
lines changed
 

‎docs/guides/customize-coderabbit.md

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ reviews:
5555
- "feat/.*"
5656
tools:
5757
ast-grep:
58-
rules_folder: "custom-rules-folder-name"
59-
utils_folder: "custom-utils-folder-name"
58+
rules_directory: "custom-rules-directory-name"
59+
utils_directory: "custom-utils-directory-name"
6060
chat:
6161
auto_reply: true
6262
```
@@ -70,47 +70,48 @@ repository.
7070

7171
YAML settings:
7272

73-
1. **language**: Set the language for reviews using the ISO language code. For
73+
1. **`language`**: Set the language for reviews using the ISO language code. For
7474
example, `"fr"` stands for French (default:`en`).
7575

76-
2. **early_access**: Enroll in the early access program to take advantage of
76+
2. **`early_access`**: Enroll in the early access program to take advantage of
7777
forthcoming features before their general release (default:`false`).
7878

79-
3. **reviews**: Configurations for the code reviews.
80-
- **request_changes_workflow**: Enable Request Changes review workflow for
79+
3. **`reviews`**: Configurations for the code reviews.
80+
- **`request_changes_workflow`**: Enable request changes review workflow for
8181
CodeRabbit reviews. (default: `false`).
82-
- **high_level_summary**: CodeRabbit generates a high level summary of the
82+
- **`high_level_summary`**: CodeRabbit generates a high-level summary of the
8383
changes (default:`true`).
84-
- **poem**: Indicates whether a creative poem should be included in the
84+
- **`poem`**: Indicates whether a creative poem should be included in the
8585
review (default:`true`).
86-
- **review_status**: Indicates the status of the review (default:`true`).
87-
- **collapse_walkthrough**: Collapses the walkthrough comment
86+
- **`review_status`**: Indicates the status of the review (default:`true`).
87+
- **`collapse_walkthrough`**: Collapses the walkthrough comment
8888
(default:`false`).
89-
- **path_filters**: Specifies file patterns to exclude or include for a
89+
- **`path_filters`**: Specifies file patterns to exclude or include for a
9090
review, such as `!dist/**` and `src/**.tsx`, using glob notation.
91-
- **path_instructions**: Provides specific additional guidelines for code
91+
- **`path_instructions`**: Provides specific additional guidelines for code
9292
review based on file paths. In the given example, JavaScript files are
9393
singled out for checks against the Google JavaScript style guide. File path
9494
accepts glob pattern
95-
- **auto_review**: Manages settings for automated code reviews, such as:
96-
- **enabled**: Automated code review (default: `true`).
97-
- **ignore_title_keywords**: Review will be ignored if a pull request title
98-
contains one of the list of keywords (e.g., `"WIP"`, `"DO NOT MERGE"`).
99-
- **labels**: Review will be triggered if a pull request contains one of
95+
- **`auto_review`**: Manages settings for automated code reviews, such as:
96+
- **`enabled`**: Automated code review (default: `true`).
97+
- **`ignore_title_keywords`**: Review will be ignored if a pull request
98+
title contains one of the list of keywords (e.g., `"WIP"`,
99+
`"DO NOT MERGE"`).
100+
- **`labels`**: Review will be triggered if a pull request contains one of
100101
the list of labels.
101-
- **drafts**: Determines whether draft pull requests are reviewed (default:
102-
`true`).
103-
- **base_branches**: A list of base branches where the reviews will occur
102+
- **`drafts`**: Determines whether draft pull requests are reviewed
103+
(default: `true`).
104+
- **`base_branches`**: A list of base branches where the reviews will occur
104105
apart from the default branch. Accepts regex pattern.
105-
- **tools**: Configurations for the tools used in the review.
106-
- **ast-grep**: Configurations for the ast-grep tool.
107-
- **rules_folder**: The folder name where the custom ast-grep rules are
108-
stored.
109-
- **utils_folder**: The folder name where the custom ast-grep utils are
110-
stored.
111-
4. **chat**: Defines the behavior of CodeRabbit's bot in conversations.
112-
- **auto_reply**: The bot automatically replies without the need of the user
113-
tagging it (default: `true`).
106+
- **`tools`**: Configurations for the tools used in the review.
107+
- **`ast-grep`**: Configurations for the `ast-grep` tool.
108+
- **`rules_directory`**: The directory name where the custom `ast-grep`
109+
rules are stored.
110+
- **`utils_directory`**: The directory name where the custom `ast-grep`
111+
utils are stored.
112+
4. **`chat`**: Defines the behavior of CodeRabbit's bot in conversations.
113+
- **`auto_reply`**: The bot automatically replies without the need of the
114+
user tagging it (default: `true`).
114115

115116
Refer:
116117
[CodeRabbit Configuration Schema](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).
@@ -157,47 +158,45 @@ settings:
157158
tools:
158159
# tools configuration for ast-grep
159160
ast-grep:
160-
rules_folder: "custom-rules-folder-name"
161-
utils_folder: "custom-utils-folder-name"
161+
rules_directory: "custom-rules-directory-name"
162+
utils_directory: "custom-utils-directory-name"
162163
```
163164

164-
<!-- ![code](./images/ymlrabbit.png) -->
165-
166165
This configuration file consists of the following settings:
167166

168-
1. **enable_draft_pr_reviews**: Set to **false** to disable draft pull
167+
1. **`enable_draft_pr_reviews`**: Set to **`false`** to disable draft pull
169168
request(PR) reviews.
170-
2. **additional_branches_to_be_reviewed**: Define additional branches to be
169+
2. **`additional_branches_to_be_reviewed`**: Define additional branches to be
171170
reviewed besides the default branch.
172-
3. **disable_high_level_summary**: If set to **true**, disables high-level
171+
3. **`disable_high_level_summary`**: If set to **`true`**, disables high-level
173172
summary generation.
174-
4. **path_based_instructions**: Allows you to specify instructions based on file
175-
paths. In this example, instructions for Python and JavaScript files are
173+
4. **`path_based_instructions`**: Allows you to specify instructions based on
174+
file paths. In this example, instructions for Python and JavaScript files are
176175
provided, encouraging adherence to the Google style guide.
177-
5. **ignored_pr_titles**: Specifies ignored PR titles, in this case, "WIP" (Work
178-
in Progress).
179-
6. **review_language**: Sets the review language to French ("fr").
180-
7. **disable_poem**: If set to **false**, enables the "poem" feature.
181-
8. **early_access_program**: Determines whether to enable the early access
182-
program (set to **false** in this case).
183-
9. **exclude_file_patterns**: Specifies patterns for excluding certain files
176+
5. **`ignored_pr_titles`**: Specifies ignored PR titles, in this case, "WIP"
177+
(Work in Progress).
178+
6. **`review_language`**: Sets the review language to French (`fr`).
179+
7. **`disable_poem`**: If set to **`false`**, enables the "poem" feature.
180+
8. **`early_access_program`**: Determines whether to enable the early access
181+
program (set to **`false`** in this case).
182+
9. **`exclude_file_patterns`**: Specifies patterns for excluding certain files
184183
from review, such as `!dist/**` and `!**.md`.
185-
10. **limit_reviews_by_label**: Limits reviews by label, targeting "first_bug"
184+
10. **`limit_reviews_by_label`**: Limits reviews by label, targeting "first_bug"
186185
label reviews.
187-
11. **disable_review**: Totally disables automatic code reviews for the
186+
11. **`disable_review`**: Totally disables automatic code reviews for the
188187
repository.
189-
12. **disable_review_status**: This is the comment posted for each incremental
188+
12. **`disable_review_status`**: This is the comment posted for each incremental
190189
review status. This removes the review status comment. Reviews will still
191190
take place. However, optional comments added to the review status will not
192191
be posted.
193-
13. **collapse_walkthrough_comment**: Specifies whether to collapse walkthrough
194-
comments on the review.
195-
14. **tools**: Configurations for the tools used in the review.
196-
- **ast-grep**: Configurations for the ast-grep tool.
197-
- **rules_folder**: The folder name where the custom ast-grep rules are
198-
stored.
199-
- **utils_folder**: The folder name where the custom ast-grep utils are
200-
stored.
192+
13. **`collapse_walkthrough_comment`**: Specifies whether to collapse
193+
walkthrough comments on the review.
194+
14. **`tools`**: Configurations for the tools used in the review.
195+
- **`ast-grep`**: Configurations for the `ast-grep` tool.
196+
- **`rules_directory`**: The directory name where the custom `ast-grep`
197+
rules are stored.
198+
- **`utils_directory`**: The directory name where the custom `ast-grep`
199+
utils are stored.
201200

202201
Refer:
203202
[CodeRabbit configuration schema](https://coderabbit.ai/integrations/coderabbit-overrides.json).
@@ -224,7 +223,7 @@ section [Prompt Customization](/guides/prompt-customization)
224223
feedback. CodeRabbit supports most of the widely used languages. The default
225224
language is English.
226225

227-
**Disable High Level Summary:** This allows disabling high-level summary added
226+
**Disable High-Level Summary:** This allows disabling high-level summary added
228227
with the pull request description.
229228

230229
---

‎docs/guides/prompt-customization.md

Lines changed: 56 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description:
77
options.
88
---
99

10-
### Path-based instructions[](https://coderabbit.ai/docs/prompt-customization#path-based-instructions)
10+
### Path-based instructions {#path-based-instructions}
1111

1212
This section explains how to add custom code review instructions for the entire
1313
project or specific file paths in your project using glob patterns. Developers
@@ -16,22 +16,22 @@ instructions are needed only if you want the reviewer to follow specific
1616
instructions besides the standard review.
1717

1818
Adding file path prompts allows developers to specify custom instructions for
19-
different parts of the codebase. For example, you may want to enforce style
19+
different parts of the codebase. For example, you may want to enforce a style
2020
guide by file types or directories.
2121

22-
### Sample Usage[](https://coderabbit.ai/docs/prompt-customization#sample-usage)
22+
### Sample Usage {#sample-usage}
2323

24-
**path:** `**/*.js`
24+
- **`path`**: `**/*.js`
2525

26-
**instructions:** Review the JavaScript code against the Google JavaScript style
27-
guide and point out any mismatches
26+
**`instructions`**: Review the JavaScript code against the Google JavaScript
27+
style guide and point out any mismatches
2828

29-
**path:** `tests/**.*`
29+
- **`path`**: `tests/**.*`
3030

31-
**instructions:** Review the following unit test code written using the Mocha
32-
test library. Ensure that: The code adheres to best practices associated with
33-
Mocha. Descriptive test names are used to clearly convey the intent of each
34-
test.
31+
**`instructions`**: Review the following unit test code written using the
32+
Mocha test library. Ensure that: The code adheres to best practices associated
33+
with Mocha. Descriptive test names are used to clearly convey the intent of
34+
each test.
3535

3636
:::note
3737

@@ -45,27 +45,33 @@ test.
4545

4646
## Abstract Syntax Tree (AST) instructions
4747

48-
:::note **Deep dive into AST patterns and ast-grep rules**
48+
:::note
49+
50+
**Deep dive into AST patterns and `ast-grep` rules**
4951

50-
- AST patterns [wikipedia](https://en.wikipedia.org/wiki/Abstract_syntax_tree)
51-
- ast-grep
52+
- Abstract Syntax Tree (AST)
53+
[Wikipedia article](https://en.wikipedia.org/wiki/Abstract_syntax_tree)
54+
- `ast-grep`
5255
[official documentation](https://ast-grep.github.io/guide/rule-config.html)
53-
for detailed guides. :::
56+
for detailed guides.
5457

55-
This section explains how to add custom code review instructions using ast-grep
56-
rules. ast-grep is a tool used for searching code using abstract syntax trees
57-
(AST) patterns.
58+
:::
5859

59-
By default, you can add ast-grep rules by following these steps:
60+
This section explains how to add custom code review instructions using
61+
`ast-grep` rules. `ast-grep` is a tool used for searching code using abstract
62+
syntax trees (AST) patterns.
6063

61-
1. Create a folder that keeps all the ast-grep rules in your project directory.
62-
2. Add individual `.yaml` files for each ast-grep rule within the newly created
63-
folder.
64-
3. Ensure that each `.yaml` file contains the necessary ast-grep rule
64+
By default, you can add `ast-grep` rules by following these steps:
65+
66+
1. Create a directory that keeps all the `ast-grep` rules in your project
67+
directory.
68+
2. Add individual `.yaml` files for each `ast-grep` rule within the newly
69+
created directory.
70+
3. Ensure that each `.yaml` file contains the necessary `ast-grep` rule
6571
configurations.
6672
4. Ensure that all rules contains a `message` property, that will be used in the
6773
review process.
68-
5. Add the rules folder to the `.coderabbit.yml` file under `tools.ast-grep`
74+
5. Add the rules' directory to the `.coderabbit.yml` file under `tools.ast-grep`
6975
configuration.
7076

7177
```yaml
@@ -74,17 +80,17 @@ reviews:
7480
#...
7581
tools:
7682
ast-grep:
77-
rules_folder: "custom-name"
83+
rules_directory: "custom-name"
7884
#...
7985
```
8086

8187
### The rule object
8288

83-
Rule object is the core concept of ast-grep's rule system and every other
89+
Rule object is the core concept of `ast-grep` rule system and every other
8490
feature is built on top of it.
8591

8692
Below is the full list of fields in a rule object. Every rule field is optional
87-
and can be omitted but at least one field should be present in a rule. A node
93+
and can be omitted, but at least one field should be present in a rule. A node
8894
will match a rule if and only if it satisfies all fields in the rule object.
8995

9096
```yaml
@@ -121,7 +127,7 @@ The rule object is inspired by the CSS selectors but with more composability and
121127
expressiveness. Thinking about how selectors in CSS works can help you
122128
understand the rule object!
123129
124-
> Read ast-grep
130+
> Read `ast-grep` >
125131
> [documentation](https://ast-grep.github.io/guide/rule-config.html) for
126132
> detailed guides.
127133

@@ -140,7 +146,7 @@ Relational rule defines the relationship between two syntax nodes. There are
140146
four kinds of relational rule: `inside`, `has`, `follows` and `precedes`.
141147

142148
All four relational rules accept a sub-rule object as their value. The sub-rule
143-
will match the surrounding node while the relational rule itself will match the
149+
will match the surrounding node, while the relational rule itself will match the
144150
target node.
145151

146152
> Official documentation guide on
@@ -156,10 +162,10 @@ rule:
156162

157163
#### Composite rule
158164

159-
Composite rule defines the logical relationship between multiple sub-rules.
165+
A composite rule defines the logical relationship between multiple sub-rules.
160166
There are three kinds of composite rule: `all`, `any` and `not`.
161167

162-
**all**
168+
**`all`**
163169

164170
The `all` rule matches if all sub-rules match.
165171

@@ -170,7 +176,7 @@ rule:
170176
- kind: expression_statement
171177
```
172178

173-
**any**
179+
**`any`**
174180

175181
`any` rule matches if any sub-rule matches.
176182

@@ -182,7 +188,7 @@ rule:
182188
- pattern: let a = $A
183189
```
184190

185-
**not**
191+
**`not`**
186192

187193
`not` applies negation to a sub-rule. It matches if the sub-rule does not match.
188194

@@ -198,13 +204,13 @@ rule:
198204

199205
### Reusing rule as utility
200206

201-
ast-grep chooses to use YAML for rule representation. While this decision makes
202-
writing rules easier, it does impose some limitations on the rule authoring. One
203-
of the limitations is that rule objects cannot be reused.
207+
`ast-grep` chooses to use YAML for rule representation. While this decision
208+
makes writing rules easier, it does impose some limitations on the rule
209+
authoring. One of the limitations is that rule objects cannot be reused.
204210

205211
#### Local utility rule
206212

207-
Local utility rules are defined in the utils field of the config file. utils is
213+
Local utility rules are defined in the utils field of the config file. Utils is
208214
a string-keyed dictionary.
209215

210216
For example, the following config file defines a local utility rule
@@ -226,9 +232,9 @@ rule:
226232
Global utility rules are defined in a separate file. But they are available
227233
across all rule configurations in the project.
228234

229-
To create global utility rules, you need to have the `rules` folder created on
230-
the root of your project and another `utils` directory inside the root of your
231-
project.
235+
To create global utility rules, you need to have the `rules` directory created
236+
on the root of your project and another `utils` directory inside the root of
237+
your project.
232238

233239
```yaml
234240
my-awesome-project # project root
@@ -238,17 +244,17 @@ my-awesome-project # project root
238244
| |- is-literal.yml
239245
```
240246

241-
> Also, you need to add the `rules` and `utils` folders to the `.coderabbit.yml`
242-
> file under `tools.ast-grep` configuration.
247+
> Also, you need to add the `rules` and `utils` directories to the
248+
> `.coderabbit.yml` file under `tools.ast-grep` configuration.
243249

244250
```yaml
245251
#...
246252
reviews:
247253
#...
248254
tools:
249255
ast-grep:
250-
rules_folder: "rules"
251-
utils_folder: "utils"
256+
rules_directory: "rules"
257+
utils_directory: "utils"
252258
#...
253259
```
254260

@@ -272,7 +278,8 @@ rule:
272278

273279
### Multiple Languages Support
274280

275-
CodeRabbit supports multiple programming languages for defining ast-grep rules.
281+
CodeRabbit supports multiple programming languages for defining `ast-grep`
282+
rules.
276283

277284
- JavaScript
278285
- Typescript
@@ -284,7 +291,7 @@ CodeRabbit supports multiple programming languages for defining ast-grep rules.
284291
- Python
285292
- C
286293

287-
Below are examples of ast-grep rules in different languages:
294+
Below are examples of `ast-grep` rules in different languages:
288295

289296
#### JavaScript
290297

@@ -309,7 +316,7 @@ rule:
309316
regex: "^import$"
310317
```
311318

312-
**No console.log allowed except console.error on the catch block**
319+
**No console.log allowed except `console.error` on the catch block**
313320

314321
```yaml
315322
id: no-console-except-error
@@ -335,9 +342,9 @@ programmers use structs and function pointers to simulate classes and methods.
335342

336343
However, this style can have some drawbacks, such as:
337344

338-
- extra memory allocation and reallocation for the struct and the function
345+
- Extra memory allocation and reallocation for the struct and the function
339346
pointer.
340-
- indirection overhead when calling the function pointer.
347+
- Indirection overhead when calling the function pointer.
341348

342349
A possible alternative is to use a plain function call with the struct pointer
343350
as the first argument.

0 commit comments

Comments
 (0)
Please sign in to comment.