This repository was archived by the owner on Aug 16, 2025. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork69
Update ast-grep docs with the new essential rules property#39
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
4 commits Select commitHold shift + click to select a range
f702e72 Update ast-grep docs with the new essential rules property
petrisorcoderabbitceb4534 Update docs/guides/review-instructions.md
petrisorcoderabbit01da60e Fix typo
petrisorcoderabbit02b2f38 Merge remote-tracking branch 'origin/update_ast_grep_docs' into updat…
petrisorcoderabbitFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
34 changes: 26 additions & 8 deletionsdocs/guides/review-instructions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -20,7 +20,7 @@ style guide by file types or directories. | ||
| - **`path`**: `**/*.js` | ||
| **`instructions`**:Review the JavaScript code against the Google JavaScript | ||
petrisorcoderabbit marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| style guide and point out any mismatches | ||
| - **`path`**: `tests/**.*` | ||
| @@ -85,10 +85,11 @@ reviews: | ||
| #... | ||
| tools: | ||
| ast-grep: | ||
| essential_rules: true # option to enable essential security rules | ||
| rule_dirs: | ||
| - "custom-name" | ||
| packages: | ||
| - "myorg/myawesomepackage" #custom packagename following the format organization/repository | ||
| #... | ||
| ``` | ||
| @@ -113,8 +114,8 @@ rule: | ||
| follows: { regex: "can|use|any" } | ||
| precedes: { kind: "multi_keys", pattern: "in.sub" } | ||
| # composite rule | ||
| all: [{ pattern: "match.all" }, { kind: "match_all" }] | ||
| any: [{ pattern: "match.any" }, { kind: "match_any" }] | ||
| not: { pattern: "not.this" } | ||
| matches: "utility-rule" | ||
| ``` | ||
| @@ -265,12 +266,12 @@ reviews: | ||
| #... | ||
| tools: | ||
| ast-grep: | ||
| essential_rules: true | ||
| rule_dirs: | ||
| - "rules" | ||
| util_dirs: | ||
| - "utils" | ||
| packages: | ||
| - "my-awesome-org/my-awesome-package" # public repository that contains ast-grep rules | ||
| #... | ||
| ``` | ||
| @@ -304,7 +305,10 @@ within your organization. | ||
| Packages provided by Coderabbit are: | ||
| - `ast-grep-essentials`: A set of essential security rules. Because we value security, this package gets | ||
| its own property in the `.coderabbit.yml` file, to make it easier to install and not overwrite. Check | ||
| the [package repository](https://github.com/coderabbitai/ast-grep-essentials) | ||
| for more information. | ||
| To use a package, you need to add the package name to the `packages` field in | ||
| the `.coderabbit.yml` file. | ||
| @@ -315,8 +319,9 @@ reviews: | ||
| #... | ||
| tools: | ||
| ast-grep: | ||
| essential_rules: true | ||
| packages: # list of packages to install, in future coderabbit will provide a set of packages, beside the essentials one. | ||
| - "my-awesome-org/my-awesome-package" # custom package name following the format organization/repository | ||
| #... | ||
| ``` | ||
| @@ -329,6 +334,19 @@ Requirements for a package: | ||
| - should be a public repository | ||
| - contains rules that follow the ast-grep rule format | ||
| - has the following folder structure: | ||
| ```text | ||
| my-awesome-project # project root | ||
| |- rules # rule directory | ||
| | |- my-rule.yml | ||
| |- utils # utils directory | ||
| | |- is-literal.yml | ||
| ``` | ||
| **rules** and **utils** directories are keywords, and it should be the same. Inside each directory, the structure is up | ||
| to you. You can also have any other root directories or files beside the two shown above. | ||
| - package name should be in the format `organization/repository` | ||
| ```yaml | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.