Skip to content

Commit ff69ede

Browse files
Update ast-grep docs with the new essential rules property (#39)
1 parent 8e0f9b3 commit ff69ede

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

docs/guides/review-instructions.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ style guide by file types or directories.
2020

2121
- **`path`**: `**/*.js`
2222

23-
**`instructions`**: Review the JavaScript code against the Google JavaScript
23+
**`instructions`**: Review the JavaScript code against the Google JavaScript
2424
style guide and point out any mismatches
2525

2626
- **`path`**: `tests/**.*`
@@ -85,10 +85,11 @@ reviews:
8585
#...
8686
tools:
8787
ast-grep:
88+
essential_rules: true # option to enable essential security rules
8889
rule_dirs:
8990
- "custom-name"
9091
packages:
91-
- "ast-grep-essentials" # default package installed
92+
- "myorg/myawesomepackage" # custom package name following the format organization/repository
9293
#...
9394
```
9495

@@ -113,8 +114,8 @@ rule:
113114
follows: { regex: "can|use|any" }
114115
precedes: { kind: "multi_keys", pattern: "in.sub" }
115116
# composite rule
116-
all: [{ pattern: "match.all" }, { kind: "match_all" }]
117-
any: [{ pattern: "match.any" }, { kind: "match_any" }]
117+
all: [ { pattern: "match.all" }, { kind: "match_all" } ]
118+
any: [ { pattern: "match.any" }, { kind: "match_any" } ]
118119
not: { pattern: "not.this" }
119120
matches: "utility-rule"
120121
```
@@ -265,12 +266,12 @@ reviews:
265266
#...
266267
tools:
267268
ast-grep:
269+
essential_rules: true
268270
rule_dirs:
269271
- "rules"
270272
util_dirs:
271273
- "utils"
272274
packages:
273-
- "ast-grep-essentials"
274275
- "my-awesome-org/my-awesome-package" # public repository that contains ast-grep rules
275276
#...
276277
```
@@ -304,7 +305,10 @@ within your organization.
304305

305306
Packages provided by Coderabbit are:
306307

307-
- `ast-grep-essentials`: A set of essential security rules
308+
- `ast-grep-essentials`: A set of essential security rules. Because we value security, this package gets
309+
its own property in the `.coderabbit.yml` file, to make it easier to install and not overwrite. Check
310+
the [package repository](https://github.com/coderabbitai/ast-grep-essentials)
311+
for more information.
308312

309313
To use a package, you need to add the package name to the `packages` field in
310314
the `.coderabbit.yml` file.
@@ -315,8 +319,9 @@ reviews:
315319
#...
316320
tools:
317321
ast-grep:
318-
packages:
319-
- "ast-grep-essentials"
322+
essential_rules: true
323+
packages: # list of packages to install, in future coderabbit will provide a set of packages, beside the essentials one.
324+
- "my-awesome-org/my-awesome-package" # custom package name following the format organization/repository
320325
#...
321326
```
322327

@@ -329,6 +334,19 @@ Requirements for a package:
329334

330335
- should be a public repository
331336
- contains rules that follow the ast-grep rule format
337+
- has the following folder structure:
338+
339+
```text
340+
my-awesome-project # project root
341+
|- rules # rule directory
342+
| |- my-rule.yml
343+
|- utils # utils directory
344+
| |- is-literal.yml
345+
```
346+
347+
**rules** and **utils** directories are keywords, and it should be the same. Inside each directory, the structure is up
348+
to you. You can also have any other root directories or files beside the two shown above.
349+
332350
- package name should be in the format `organization/repository`
333351

334352
```yaml

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy