@@ -20,7 +20,7 @@ style guide by file types or directories.
20
20
21
21
- ** ` path ` ** : ` **/*.js `
22
22
23
- ** ` instructions ` ** : Review the JavaScript code against the Google JavaScript
23
+ ** ` instructions ` ** : Review the JavaScript code against the Google JavaScript
24
24
style guide and point out any mismatches
25
25
26
26
- ** ` path ` ** : ` tests/**.* `
@@ -85,10 +85,11 @@ reviews:
85
85
# ...
86
86
tools :
87
87
ast-grep :
88
+ essential_rules : true # option to enable essential security rules
88
89
rule_dirs :
89
90
- " custom-name"
90
91
packages :
91
- - " ast-grep-essentials " # default package installed
92
+ - " myorg/myawesomepackage " # custom package name following the format organization/repository
92
93
# ...
93
94
```
94
95
@@ -113,8 +114,8 @@ rule:
113
114
follows : { regex: "can|use|any" }
114
115
precedes : { kind: "multi_keys", pattern: "in.sub" }
115
116
# 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" } ]
118
119
not : { pattern: "not.this" }
119
120
matches : " utility-rule"
120
121
` ` `
@@ -265,12 +266,12 @@ reviews:
265
266
#...
266
267
tools:
267
268
ast-grep:
269
+ essential_rules: true
268
270
rule_dirs:
269
271
- "rules"
270
272
util_dirs:
271
273
- "utils"
272
274
packages:
273
- - "ast-grep-essentials"
274
275
- "my-awesome-org/my-awesome-package" # public repository that contains ast-grep rules
275
276
#...
276
277
` ` `
@@ -304,7 +305,10 @@ within your organization.
304
305
305
306
Packages provided by Coderabbit are :
306
307
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.
308
312
309
313
To use a package, you need to add the package name to the `packages` field in
310
314
the `.coderabbit.yml` file.
@@ -315,8 +319,9 @@ reviews:
315
319
#...
316
320
tools:
317
321
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
320
325
#...
321
326
` ` `
322
327
@@ -329,6 +334,19 @@ Requirements for a package:
329
334
330
335
- should be a public repository
331
336
- 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
+
332
350
- package name should be in the format `organization/repository`
333
351
334
352
` ` ` yaml
0 commit comments