You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/guide/scan-project.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,19 @@
2
2
3
3
Let's explore its power to run scan on your code repository in a scalable way!
4
4
5
-
`sg scan` is the command you can use to run multiple rules against your repository so that you don't need to pass pattern query to your command line every time.
5
+
`ast-grep scan` is the command you can use to run multiple rules against your repository so that you don't need to pass pattern query to your command line every time.
6
6
7
7
However, to ast-grep's scan need some scaffolding for project setup. We will walk through the process in this guide.
8
8
9
9
:::tip
10
-
`sg scan` requires at least one file and one directory to work:
10
+
`ast-grep scan` requires at least one file and one directory to work:
11
11
*`sgconfig.yml`, the [project configuration](/reference/sgconfig.html) file
12
12
* a directory storing rule files, usually `rules/`
13
13
:::
14
14
15
15
## Create Scaffolding
16
16
17
-
To set up ast-grep's scanning, you can simply run the command `sg new` in the root directory of your repository. You will be guided with a series of interactive questions, like the following:
17
+
To set up ast-grep's scanning, you can simply run the command `ast-grep new` in the root directory of your repository. You will be guided with a series of interactive questions, like the following:
18
18
19
19
```markdown
20
20
No sgconfig.yml found. Creating a new ast-grep project...
@@ -38,7 +38,7 @@ my-awesome-project
38
38
39
39
## Create the Rule
40
40
41
-
Now you can start creating a rule! Continue using `sg new`, it will ask you what to create. But you can also use `sg new rule` to create a rule directly!
41
+
Now you can start creating a rule! Continue using `ast-grep new`, it will ask you what to create. But you can also use `ast-grep new rule` to create a rule directly!
42
42
43
43
You will be asked several questions about the rule going to be created. Suppose we want to create a rule to ensure no eval in JavaScript.
44
44
@@ -86,7 +86,7 @@ Okay! The pattern syntax works just like what we have learnt before.
86
86
87
87
Now you can try scanning the code! You can create a JavaScript file containing `eval` to test it.
88
88
89
-
Run `sg scan` in your project, ast-grep will give you some beautiful scan report!
89
+
Run `ast-grep scan` in your project, ast-grep will give you some beautiful scan report!
90
90
91
91
```bash
92
92
error[no-eval]: Add your rule message here....
@@ -106,6 +106,6 @@ In this section we learnt how to set up ast-grep project, create new rules using
106
106
107
107
To summarize the commands we used:
108
108
109
-
* `sg new` - Create a new ast-grep project
110
-
* `sg new rule` - Create a new rule in a rule folder.
111
-
* `sg scan` - Scan the codebase with the rules in the project.
109
+
* `ast-grep new` - Create a new ast-grep project
110
+
* `ast-grep new rule` - Create a new rule in a rule folder.
111
+
* `ast-grep scan` - Scan the codebase with the rules in the project.
0 commit comments