Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Update ast-grep docs with the new essential rules property#39

Merged
petrisorcoderabbit merged 4 commits intomasterfromupdate_ast_grep_docs
Apr 6, 2024
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletionsdocs/guides/review-instructions.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ style guide by file types or directories.

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

**`instructions`**: Review the JavaScript code against the Google JavaScript
**`instructions`**:Review the JavaScript code against the Google JavaScript
style guide and point out any mismatches

- **`path`**: `tests/**.*`
Expand DownExpand Up@@ -85,10 +85,11 @@ reviews:
#...
tools:
ast-grep:
essential_rules: true # option to enable essential security rules
rule_dirs:
- "custom-name"
packages:
- "ast-grep-essentials" #default packageinstalled
- "myorg/myawesomepackage" #custom packagename following the format organization/repository
#...
```

Expand All@@ -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" }]
all: [{ pattern: "match.all" }, { kind: "match_all" }]
any: [{ pattern: "match.any" }, { kind: "match_any" }]
not: { pattern: "not.this" }
matches: "utility-rule"
```
Expand DownExpand Up@@ -265,12 +266,12 @@ reviews:
#...
tools:
ast-grep:
essential_rules: true
rule_dirs:
- "rules"
util_dirs:
- "utils"
packages:
- "ast-grep-essentials"
- "my-awesome-org/my-awesome-package" # public repository that contains ast-grep rules
#...
```
Expand DownExpand Up@@ -304,7 +305,10 @@ within your organization.

Packages provided by Coderabbit are:

- `ast-grep-essentials`: A set of essential security rules
- `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.
Expand All@@ -315,8 +319,9 @@ reviews:
#...
tools:
ast-grep:
packages:
- "ast-grep-essentials"
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
#...
```

Expand All@@ -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
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp