@@ -71,6 +71,8 @@ def dump_syntax_tree(
71
71
`format` is the output format of the syntax tree.
72
72
use `format=cst` to inspect the code's concrete syntax tree structure, useful to debug target code.
73
73
use `format=pattern` to inspect how ast-grep interprets a pattern, useful to debug pattern rule.
74
+
75
+ Internally calls: ast-grep run --pattern <code> --lang <language> --debug-query=<format>
74
76
"""
75
77
return run_ast_grep_dump (code , language , format .value )
76
78
@@ -83,6 +85,8 @@ def test_match_code_rule(
83
85
"""
84
86
Test a code against an ast-grep YAML rule.
85
87
This is useful to test a rule before using it in a project.
88
+
89
+ Internally calls: ast-grep scan --inline-rules <yaml> --json --stdin
86
90
"""
87
91
args = ["ast-grep" , "scan" ,"--inline-rules" , yaml , "--json" , "--stdin" ]
88
92
if CONFIG_PATH :
@@ -113,6 +117,8 @@ def find_code(
113
117
Find code in a project folder that matches the given ast-grep pattern.
114
118
Pattern is good for simple and single-AST node result.
115
119
For more complex usage, please use YAML by `find_code_by_rule`.
120
+
121
+ Internally calls: ast-grep run --pattern <pattern> --json <project_folder>
116
122
"""
117
123
return run_ast_grep_command (pattern , project_folder , language )
118
124
@@ -127,6 +133,8 @@ def find_code_by_rule(
127
133
It is a more advanced search tool than the simple `find_code`.
128
134
129
135
Tip: When using relational rules (inside/has), add `stopBy: end` to ensure complete traversal.
136
+
137
+ Internally calls: ast-grep scan --inline-rules <yaml> --json <project_folder>
130
138
"""
131
139
return run_ast_grep_yaml (yaml , project_folder )
132
140
0 commit comments