ast-grep-cli 0.36.2__tar.gz → 0.36.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/Cargo.lock +105 -75
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/Cargo.toml +6 -6
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/PKG-INFO +1 -1
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/Cargo.toml +2 -2
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/tests/scan_test.rs +36 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/check_var.rs +4 -5
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule/deserialize_env.rs +7 -12
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule/referent_rule.rs +39 -53
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule_config.rs +11 -32
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule_core.rs +11 -17
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/transform/rewrite.rs +31 -33
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/replacer/indent.rs +2 -1
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/replacer/template.rs +22 -3
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/pyproject.toml +1 -1
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/LICENSE +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/README.md +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/README.md +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/bin/alias.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/completions.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/config.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/lang/injection.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/lang/lang_globs.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/lang/mod.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/lib.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/lsp.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/main.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/new.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/print/cloud_print.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/print/colored_print/match_merger.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/print/colored_print/styles.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/print/colored_print/test.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/print/colored_print.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/print/interactive_print.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/print/json_print.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/print/mod.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/run.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/scan.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/utils/args.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/utils/debug_query.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/utils/error_context.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/utils/inspect.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/utils/mod.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/utils/print_diff.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/utils/rule_overwrite.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/utils/worker.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/verify/case_result.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/verify/find_file.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/verify/reporter.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/verify/snapshot.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/verify/test_case.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/src/verify.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/tests/common/mod.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/tests/run_test.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/cli/tests/verify_test.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/Cargo.toml +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/combined.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/fixer.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/lib.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/maybe.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule/mod.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule/nth_child.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule/range.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule/relational_rule.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule/stop_by.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/rule_collection.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/transform/mod.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/transform/string_case.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/config/src/transform/transformation.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/Cargo.toml +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/language.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/lib.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/match_tree/match_node.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/match_tree/mod.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/match_tree/strictness.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/matcher/kind.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/matcher/node_match.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/matcher/pattern.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/matcher/text.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/matcher.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/meta_var.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/node.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/ops.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/pinned.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/replacer/structural.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/replacer.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/source.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/core/src/traversal.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/dynamic/Cargo.toml +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/dynamic/src/custom_lang.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/dynamic/src/lib.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/Cargo.toml +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/bash.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/cpp.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/csharp.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/css.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/elixir.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/go.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/haskell.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/html.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/json.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/kotlin.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/lib.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/lua.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/parsers.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/php.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/python.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/ruby.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/rust.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/scala.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/swift.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/language/src/yaml.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/lsp/Cargo.toml +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/lsp/src/lib.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/lsp/src/utils.rs +0 -0
- {ast_grep_cli-0.36.2 → ast_grep_cli-0.36.3}/crates/lsp/tests/basic.rs +0 -0
|
@@ -114,7 +114,7 @@ dependencies = [
|
|
|
114
114
|
|
|
115
115
|
[[package]]
|
|
116
116
|
name = "ast-grep"
|
|
117
|
-
version = "0.36.
|
|
117
|
+
version = "0.36.3"
|
|
118
118
|
dependencies = [
|
|
119
119
|
"ansi_term",
|
|
120
120
|
"anyhow",
|
|
@@ -128,7 +128,7 @@ dependencies = [
|
|
|
128
128
|
"clap",
|
|
129
129
|
"clap_complete",
|
|
130
130
|
"codespan-reporting",
|
|
131
|
-
"crossterm 0.
|
|
131
|
+
"crossterm 0.29.0",
|
|
132
132
|
"ignore",
|
|
133
133
|
"inquire",
|
|
134
134
|
"predicates",
|
|
@@ -145,7 +145,7 @@ dependencies = [
|
|
|
145
145
|
|
|
146
146
|
[[package]]
|
|
147
147
|
name = "ast-grep-config"
|
|
148
|
-
version = "0.36.
|
|
148
|
+
version = "0.36.3"
|
|
149
149
|
dependencies = [
|
|
150
150
|
"anyhow",
|
|
151
151
|
"ast-grep-core",
|
|
@@ -161,7 +161,7 @@ dependencies = [
|
|
|
161
161
|
|
|
162
162
|
[[package]]
|
|
163
163
|
name = "ast-grep-core"
|
|
164
|
-
version = "0.36.
|
|
164
|
+
version = "0.36.3"
|
|
165
165
|
dependencies = [
|
|
166
166
|
"bit-set",
|
|
167
167
|
"regex",
|
|
@@ -172,7 +172,7 @@ dependencies = [
|
|
|
172
172
|
|
|
173
173
|
[[package]]
|
|
174
174
|
name = "ast-grep-dynamic"
|
|
175
|
-
version = "0.36.
|
|
175
|
+
version = "0.36.3"
|
|
176
176
|
dependencies = [
|
|
177
177
|
"ast-grep-core",
|
|
178
178
|
"ignore",
|
|
@@ -185,7 +185,7 @@ dependencies = [
|
|
|
185
185
|
|
|
186
186
|
[[package]]
|
|
187
187
|
name = "ast-grep-language"
|
|
188
|
-
version = "0.36.
|
|
188
|
+
version = "0.36.3"
|
|
189
189
|
dependencies = [
|
|
190
190
|
"ast-grep-core",
|
|
191
191
|
"ignore",
|
|
@@ -216,7 +216,7 @@ dependencies = [
|
|
|
216
216
|
|
|
217
217
|
[[package]]
|
|
218
218
|
name = "ast-grep-lsp"
|
|
219
|
-
version = "0.36.
|
|
219
|
+
version = "0.36.3"
|
|
220
220
|
dependencies = [
|
|
221
221
|
"ast-grep-config",
|
|
222
222
|
"ast-grep-core",
|
|
@@ -230,7 +230,7 @@ dependencies = [
|
|
|
230
230
|
|
|
231
231
|
[[package]]
|
|
232
232
|
name = "ast-grep-napi"
|
|
233
|
-
version = "0.36.
|
|
233
|
+
version = "0.36.3"
|
|
234
234
|
dependencies = [
|
|
235
235
|
"ast-grep-config",
|
|
236
236
|
"ast-grep-core",
|
|
@@ -246,7 +246,7 @@ dependencies = [
|
|
|
246
246
|
|
|
247
247
|
[[package]]
|
|
248
248
|
name = "ast-grep-py"
|
|
249
|
-
version = "0.36.
|
|
249
|
+
version = "0.36.3"
|
|
250
250
|
dependencies = [
|
|
251
251
|
"anyhow",
|
|
252
252
|
"ast-grep-config",
|
|
@@ -314,7 +314,7 @@ dependencies = [
|
|
|
314
314
|
|
|
315
315
|
[[package]]
|
|
316
316
|
name = "benches"
|
|
317
|
-
version = "0.36.
|
|
317
|
+
version = "0.36.3"
|
|
318
318
|
dependencies = [
|
|
319
319
|
"ast-grep-config",
|
|
320
320
|
"ast-grep-core",
|
|
@@ -345,9 +345,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
|
345
345
|
|
|
346
346
|
[[package]]
|
|
347
347
|
name = "bitflags"
|
|
348
|
-
version = "2.
|
|
348
|
+
version = "2.9.0"
|
|
349
349
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
350
|
-
checksum = "
|
|
350
|
+
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
|
351
351
|
|
|
352
352
|
[[package]]
|
|
353
353
|
name = "bstr"
|
|
@@ -428,9 +428,9 @@ dependencies = [
|
|
|
428
428
|
|
|
429
429
|
[[package]]
|
|
430
430
|
name = "clap"
|
|
431
|
-
version = "4.5.
|
|
431
|
+
version = "4.5.36"
|
|
432
432
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
433
|
-
checksum = "
|
|
433
|
+
checksum = "2df961d8c8a0d08aa9945718ccf584145eee3f3aa06cddbeac12933781102e04"
|
|
434
434
|
dependencies = [
|
|
435
435
|
"clap_builder",
|
|
436
436
|
"clap_derive",
|
|
@@ -438,9 +438,9 @@ dependencies = [
|
|
|
438
438
|
|
|
439
439
|
[[package]]
|
|
440
440
|
name = "clap_builder"
|
|
441
|
-
version = "4.5.
|
|
441
|
+
version = "4.5.36"
|
|
442
442
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
443
|
-
checksum = "
|
|
443
|
+
checksum = "132dbda40fb6753878316a489d5a1242a8ef2f0d9e47ba01c951ea8aa7d013a5"
|
|
444
444
|
dependencies = [
|
|
445
445
|
"anstream",
|
|
446
446
|
"anstyle",
|
|
@@ -450,9 +450,9 @@ dependencies = [
|
|
|
450
450
|
|
|
451
451
|
[[package]]
|
|
452
452
|
name = "clap_complete"
|
|
453
|
-
version = "4.5.
|
|
453
|
+
version = "4.5.47"
|
|
454
454
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
455
|
-
checksum = "
|
|
455
|
+
checksum = "c06f5378ea264ad4f82bbc826628b5aad714a75abf6ece087e923010eb937fb6"
|
|
456
456
|
dependencies = [
|
|
457
457
|
"clap",
|
|
458
458
|
]
|
|
@@ -477,10 +477,11 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
|
|
477
477
|
|
|
478
478
|
[[package]]
|
|
479
479
|
name = "codespan-reporting"
|
|
480
|
-
version = "0.
|
|
480
|
+
version = "0.12.0"
|
|
481
481
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
482
|
-
checksum = "
|
|
482
|
+
checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81"
|
|
483
483
|
dependencies = [
|
|
484
|
+
"serde",
|
|
484
485
|
"termcolor",
|
|
485
486
|
"unicode-width",
|
|
486
487
|
]
|
|
@@ -500,6 +501,15 @@ dependencies = [
|
|
|
500
501
|
"unicode-segmentation",
|
|
501
502
|
]
|
|
502
503
|
|
|
504
|
+
[[package]]
|
|
505
|
+
name = "convert_case"
|
|
506
|
+
version = "0.7.1"
|
|
507
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
508
|
+
checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7"
|
|
509
|
+
dependencies = [
|
|
510
|
+
"unicode-segmentation",
|
|
511
|
+
]
|
|
512
|
+
|
|
503
513
|
[[package]]
|
|
504
514
|
name = "criterion"
|
|
505
515
|
version = "0.5.1"
|
|
@@ -579,15 +589,17 @@ dependencies = [
|
|
|
579
589
|
|
|
580
590
|
[[package]]
|
|
581
591
|
name = "crossterm"
|
|
582
|
-
version = "0.
|
|
592
|
+
version = "0.29.0"
|
|
583
593
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
584
|
-
checksum = "
|
|
594
|
+
checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b"
|
|
585
595
|
dependencies = [
|
|
586
|
-
"bitflags 2.
|
|
596
|
+
"bitflags 2.9.0",
|
|
587
597
|
"crossterm_winapi",
|
|
598
|
+
"derive_more",
|
|
599
|
+
"document-features",
|
|
588
600
|
"mio 1.0.1",
|
|
589
601
|
"parking_lot",
|
|
590
|
-
"rustix
|
|
602
|
+
"rustix",
|
|
591
603
|
"signal-hook",
|
|
592
604
|
"signal-hook-mio",
|
|
593
605
|
"winapi",
|
|
@@ -645,6 +657,27 @@ dependencies = [
|
|
|
645
657
|
"parking_lot_core",
|
|
646
658
|
]
|
|
647
659
|
|
|
660
|
+
[[package]]
|
|
661
|
+
name = "derive_more"
|
|
662
|
+
version = "2.0.1"
|
|
663
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
664
|
+
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
|
|
665
|
+
dependencies = [
|
|
666
|
+
"derive_more-impl",
|
|
667
|
+
]
|
|
668
|
+
|
|
669
|
+
[[package]]
|
|
670
|
+
name = "derive_more-impl"
|
|
671
|
+
version = "2.0.1"
|
|
672
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
673
|
+
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
|
|
674
|
+
dependencies = [
|
|
675
|
+
"convert_case 0.7.1",
|
|
676
|
+
"proc-macro2",
|
|
677
|
+
"quote",
|
|
678
|
+
"syn",
|
|
679
|
+
]
|
|
680
|
+
|
|
648
681
|
[[package]]
|
|
649
682
|
name = "difflib"
|
|
650
683
|
version = "0.4.0"
|
|
@@ -657,6 +690,15 @@ version = "0.3.3"
|
|
|
657
690
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
658
691
|
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
|
659
692
|
|
|
693
|
+
[[package]]
|
|
694
|
+
name = "document-features"
|
|
695
|
+
version = "0.2.11"
|
|
696
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
697
|
+
checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
|
|
698
|
+
dependencies = [
|
|
699
|
+
"litrs",
|
|
700
|
+
]
|
|
701
|
+
|
|
660
702
|
[[package]]
|
|
661
703
|
name = "dyn-clone"
|
|
662
704
|
version = "1.0.17"
|
|
@@ -926,7 +968,7 @@ version = "0.7.5"
|
|
|
926
968
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
927
969
|
checksum = "0fddf93031af70e75410a2511ec04d49e758ed2f26dad3404a934e0fb45cc12a"
|
|
928
970
|
dependencies = [
|
|
929
|
-
"bitflags 2.
|
|
971
|
+
"bitflags 2.9.0",
|
|
930
972
|
"crossterm 0.25.0",
|
|
931
973
|
"dyn-clone",
|
|
932
974
|
"fuzzy-matcher",
|
|
@@ -996,15 +1038,15 @@ dependencies = [
|
|
|
996
1038
|
|
|
997
1039
|
[[package]]
|
|
998
1040
|
name = "linux-raw-sys"
|
|
999
|
-
version = "0.
|
|
1041
|
+
version = "0.9.2"
|
|
1000
1042
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1001
|
-
checksum = "
|
|
1043
|
+
checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9"
|
|
1002
1044
|
|
|
1003
1045
|
[[package]]
|
|
1004
|
-
name = "
|
|
1005
|
-
version = "0.
|
|
1046
|
+
name = "litrs"
|
|
1047
|
+
version = "0.4.1"
|
|
1006
1048
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1007
|
-
checksum = "
|
|
1049
|
+
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
|
1008
1050
|
|
|
1009
1051
|
[[package]]
|
|
1010
1052
|
name = "lock_api"
|
|
@@ -1086,12 +1128,12 @@ dependencies = [
|
|
|
1086
1128
|
|
|
1087
1129
|
[[package]]
|
|
1088
1130
|
name = "napi"
|
|
1089
|
-
version = "2.16.
|
|
1131
|
+
version = "2.16.17"
|
|
1090
1132
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1091
|
-
checksum = "
|
|
1133
|
+
checksum = "55740c4ae1d8696773c78fdafd5d0e5fe9bc9f1b071c7ba493ba5c413a9184f3"
|
|
1092
1134
|
dependencies = [
|
|
1093
1135
|
"anyhow",
|
|
1094
|
-
"bitflags 2.
|
|
1136
|
+
"bitflags 2.9.0",
|
|
1095
1137
|
"ctor",
|
|
1096
1138
|
"napi-derive",
|
|
1097
1139
|
"napi-sys",
|
|
@@ -1102,9 +1144,9 @@ dependencies = [
|
|
|
1102
1144
|
|
|
1103
1145
|
[[package]]
|
|
1104
1146
|
name = "napi-build"
|
|
1105
|
-
version = "2.1.
|
|
1147
|
+
version = "2.1.6"
|
|
1106
1148
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1107
|
-
checksum = "
|
|
1149
|
+
checksum = "e28acfa557c083f6e254a786e01ba253fc56f18ee000afcd4f79af735f73a6da"
|
|
1108
1150
|
|
|
1109
1151
|
[[package]]
|
|
1110
1152
|
name = "napi-derive"
|
|
@@ -1113,7 +1155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
1113
1155
|
checksum = "7cbe2585d8ac223f7d34f13701434b9d5f4eb9c332cccce8dee57ea18ab8ab0c"
|
|
1114
1156
|
dependencies = [
|
|
1115
1157
|
"cfg-if",
|
|
1116
|
-
"convert_case",
|
|
1158
|
+
"convert_case 0.6.0",
|
|
1117
1159
|
"napi-derive-backend",
|
|
1118
1160
|
"proc-macro2",
|
|
1119
1161
|
"quote",
|
|
@@ -1126,7 +1168,7 @@ version = "1.0.75"
|
|
|
1126
1168
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1127
1169
|
checksum = "1639aaa9eeb76e91c6ae66da8ce3e89e921cd3885e99ec85f4abacae72fc91bf"
|
|
1128
1170
|
dependencies = [
|
|
1129
|
-
"convert_case",
|
|
1171
|
+
"convert_case 0.6.0",
|
|
1130
1172
|
"once_cell",
|
|
1131
1173
|
"proc-macro2",
|
|
1132
1174
|
"quote",
|
|
@@ -1325,9 +1367,9 @@ dependencies = [
|
|
|
1325
1367
|
|
|
1326
1368
|
[[package]]
|
|
1327
1369
|
name = "pyo3"
|
|
1328
|
-
version = "0.
|
|
1370
|
+
version = "0.24.1"
|
|
1329
1371
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1330
|
-
checksum = "
|
|
1372
|
+
checksum = "17da310086b068fbdcefbba30aeb3721d5bb9af8db4987d6735b2183ca567229"
|
|
1331
1373
|
dependencies = [
|
|
1332
1374
|
"anyhow",
|
|
1333
1375
|
"cfg-if",
|
|
@@ -1344,9 +1386,9 @@ dependencies = [
|
|
|
1344
1386
|
|
|
1345
1387
|
[[package]]
|
|
1346
1388
|
name = "pyo3-build-config"
|
|
1347
|
-
version = "0.
|
|
1389
|
+
version = "0.24.1"
|
|
1348
1390
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1349
|
-
checksum = "
|
|
1391
|
+
checksum = "e27165889bd793000a098bb966adc4300c312497ea25cf7a690a9f0ac5aa5fc1"
|
|
1350
1392
|
dependencies = [
|
|
1351
1393
|
"once_cell",
|
|
1352
1394
|
"target-lexicon",
|
|
@@ -1354,9 +1396,9 @@ dependencies = [
|
|
|
1354
1396
|
|
|
1355
1397
|
[[package]]
|
|
1356
1398
|
name = "pyo3-ffi"
|
|
1357
|
-
version = "0.
|
|
1399
|
+
version = "0.24.1"
|
|
1358
1400
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1359
|
-
checksum = "
|
|
1401
|
+
checksum = "05280526e1dbf6b420062f3ef228b78c0c54ba94e157f5cb724a609d0f2faabc"
|
|
1360
1402
|
dependencies = [
|
|
1361
1403
|
"libc",
|
|
1362
1404
|
"pyo3-build-config",
|
|
@@ -1364,9 +1406,9 @@ dependencies = [
|
|
|
1364
1406
|
|
|
1365
1407
|
[[package]]
|
|
1366
1408
|
name = "pyo3-macros"
|
|
1367
|
-
version = "0.
|
|
1409
|
+
version = "0.24.1"
|
|
1368
1410
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1369
|
-
checksum = "
|
|
1411
|
+
checksum = "5c3ce5686aa4d3f63359a5100c62a127c9f15e8398e5fdeb5deef1fed5cd5f44"
|
|
1370
1412
|
dependencies = [
|
|
1371
1413
|
"proc-macro2",
|
|
1372
1414
|
"pyo3-macros-backend",
|
|
@@ -1376,9 +1418,9 @@ dependencies = [
|
|
|
1376
1418
|
|
|
1377
1419
|
[[package]]
|
|
1378
1420
|
name = "pyo3-macros-backend"
|
|
1379
|
-
version = "0.
|
|
1421
|
+
version = "0.24.1"
|
|
1380
1422
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1381
|
-
checksum = "
|
|
1423
|
+
checksum = "f4cf6faa0cbfb0ed08e89beb8103ae9724eb4750e3a78084ba4017cbe94f3855"
|
|
1382
1424
|
dependencies = [
|
|
1383
1425
|
"heck",
|
|
1384
1426
|
"proc-macro2",
|
|
@@ -1389,9 +1431,9 @@ dependencies = [
|
|
|
1389
1431
|
|
|
1390
1432
|
[[package]]
|
|
1391
1433
|
name = "pythonize"
|
|
1392
|
-
version = "0.
|
|
1434
|
+
version = "0.24.0"
|
|
1393
1435
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1394
|
-
checksum = "
|
|
1436
|
+
checksum = "d5bcac0d0b71821f0d69e42654f1e15e5c94b85196446c4de9588951a2117e7b"
|
|
1395
1437
|
dependencies = [
|
|
1396
1438
|
"pyo3",
|
|
1397
1439
|
"serde",
|
|
@@ -1432,7 +1474,7 @@ version = "0.5.1"
|
|
|
1432
1474
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1433
1475
|
checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
|
|
1434
1476
|
dependencies = [
|
|
1435
|
-
"bitflags 2.
|
|
1477
|
+
"bitflags 2.9.0",
|
|
1436
1478
|
]
|
|
1437
1479
|
|
|
1438
1480
|
[[package]]
|
|
@@ -1470,29 +1512,16 @@ version = "0.1.24"
|
|
|
1470
1512
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1471
1513
|
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
|
1472
1514
|
|
|
1473
|
-
[[package]]
|
|
1474
|
-
name = "rustix"
|
|
1475
|
-
version = "0.38.41"
|
|
1476
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1477
|
-
checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6"
|
|
1478
|
-
dependencies = [
|
|
1479
|
-
"bitflags 2.5.0",
|
|
1480
|
-
"errno",
|
|
1481
|
-
"libc",
|
|
1482
|
-
"linux-raw-sys 0.4.14",
|
|
1483
|
-
"windows-sys 0.52.0",
|
|
1484
|
-
]
|
|
1485
|
-
|
|
1486
1515
|
[[package]]
|
|
1487
1516
|
name = "rustix"
|
|
1488
1517
|
version = "1.0.0"
|
|
1489
1518
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1490
1519
|
checksum = "17f8dcd64f141950290e45c99f7710ede1b600297c91818bb30b3667c0f45dc0"
|
|
1491
1520
|
dependencies = [
|
|
1492
|
-
"bitflags 2.
|
|
1521
|
+
"bitflags 2.9.0",
|
|
1493
1522
|
"errno",
|
|
1494
1523
|
"libc",
|
|
1495
|
-
"linux-raw-sys
|
|
1524
|
+
"linux-raw-sys",
|
|
1496
1525
|
"windows-sys 0.52.0",
|
|
1497
1526
|
]
|
|
1498
1527
|
|
|
@@ -1669,9 +1698,9 @@ dependencies = [
|
|
|
1669
1698
|
|
|
1670
1699
|
[[package]]
|
|
1671
1700
|
name = "smallvec"
|
|
1672
|
-
version = "1.
|
|
1701
|
+
version = "1.15.0"
|
|
1673
1702
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1674
|
-
checksum = "
|
|
1703
|
+
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
|
|
1675
1704
|
|
|
1676
1705
|
[[package]]
|
|
1677
1706
|
name = "streaming-iterator"
|
|
@@ -1698,20 +1727,20 @@ dependencies = [
|
|
|
1698
1727
|
|
|
1699
1728
|
[[package]]
|
|
1700
1729
|
name = "target-lexicon"
|
|
1701
|
-
version = "0.
|
|
1730
|
+
version = "0.13.2"
|
|
1702
1731
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1703
|
-
checksum = "
|
|
1732
|
+
checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
|
1704
1733
|
|
|
1705
1734
|
[[package]]
|
|
1706
1735
|
name = "tempfile"
|
|
1707
|
-
version = "3.19.
|
|
1736
|
+
version = "3.19.1"
|
|
1708
1737
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1709
|
-
checksum = "
|
|
1738
|
+
checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf"
|
|
1710
1739
|
dependencies = [
|
|
1711
1740
|
"fastrand",
|
|
1712
1741
|
"getrandom",
|
|
1713
1742
|
"once_cell",
|
|
1714
|
-
"rustix
|
|
1743
|
+
"rustix",
|
|
1715
1744
|
"windows-sys 0.52.0",
|
|
1716
1745
|
]
|
|
1717
1746
|
|
|
@@ -1787,9 +1816,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|
|
1787
1816
|
|
|
1788
1817
|
[[package]]
|
|
1789
1818
|
name = "tokio"
|
|
1790
|
-
version = "1.44.
|
|
1819
|
+
version = "1.44.2"
|
|
1791
1820
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1792
|
-
checksum = "
|
|
1821
|
+
checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48"
|
|
1793
1822
|
dependencies = [
|
|
1794
1823
|
"backtrace",
|
|
1795
1824
|
"bytes",
|
|
@@ -2539,7 +2568,7 @@ version = "0.33.0"
|
|
|
2539
2568
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2540
2569
|
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
|
|
2541
2570
|
dependencies = [
|
|
2542
|
-
"bitflags 2.
|
|
2571
|
+
"bitflags 2.9.0",
|
|
2543
2572
|
]
|
|
2544
2573
|
|
|
2545
2574
|
[[package]]
|
|
@@ -2549,6 +2578,7 @@ dependencies = [
|
|
|
2549
2578
|
"anyhow",
|
|
2550
2579
|
"ast-grep-config",
|
|
2551
2580
|
"ast-grep-core",
|
|
2581
|
+
"ast-grep-language",
|
|
2552
2582
|
"schemars",
|
|
2553
2583
|
"serde_json",
|
|
2554
2584
|
"toml_edit",
|
|
@@ -7,7 +7,7 @@ resolver = "2"
|
|
|
7
7
|
lto = true
|
|
8
8
|
|
|
9
9
|
[workspace.package]
|
|
10
|
-
version = "0.36.
|
|
10
|
+
version = "0.36.3"
|
|
11
11
|
authors = ["Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>"]
|
|
12
12
|
edition = "2021"
|
|
13
13
|
license = "MIT"
|
|
@@ -18,11 +18,11 @@ rust-version = "1.70"
|
|
|
18
18
|
readme = "README.md"
|
|
19
19
|
|
|
20
20
|
[workspace.dependencies]
|
|
21
|
-
ast-grep-core = { path = "crates/core", version = "0.36.
|
|
22
|
-
ast-grep-config = { path = "crates/config", version = "0.36.
|
|
23
|
-
ast-grep-dynamic = { path = "crates/dynamic", version = "0.36.
|
|
24
|
-
ast-grep-language = { path = "crates/language", version = "0.36.
|
|
25
|
-
ast-grep-lsp = { path = "crates/lsp", version = "0.36.
|
|
21
|
+
ast-grep-core = { path = "crates/core", version = "0.36.3" }
|
|
22
|
+
ast-grep-config = { path = "crates/config", version = "0.36.3" }
|
|
23
|
+
ast-grep-dynamic = { path = "crates/dynamic", version = "0.36.3" }
|
|
24
|
+
ast-grep-language = { path = "crates/language", version = "0.36.3" }
|
|
25
|
+
ast-grep-lsp = { path = "crates/lsp", version = "0.36.3" }
|
|
26
26
|
|
|
27
27
|
bit-set = { version = "0.8.0" }
|
|
28
28
|
ignore = { version = "0.4.22" }
|
|
@@ -37,8 +37,8 @@ ansi_term = "0.12.1"
|
|
|
37
37
|
anyhow.workspace = true
|
|
38
38
|
atty = "0.2.14"
|
|
39
39
|
clap = { version = "4.5.4", features = ["derive"] }
|
|
40
|
-
codespan-reporting = "0.
|
|
41
|
-
crossterm = "0.
|
|
40
|
+
codespan-reporting = "0.12.0"
|
|
41
|
+
crossterm = "0.29.0"
|
|
42
42
|
ignore.workspace = true
|
|
43
43
|
regex.workspace = true
|
|
44
44
|
inquire = "0.7.5"
|
|
@@ -232,3 +232,39 @@ fn test_severity_override() -> Result<()> {
|
|
|
232
232
|
.stdout(contains("warning"));
|
|
233
233
|
Ok(())
|
|
234
234
|
}
|
|
235
|
+
|
|
236
|
+
const PY_RULE: &str = r"
|
|
237
|
+
id: transform-indent
|
|
238
|
+
language: python
|
|
239
|
+
rule: { pattern: 'class $CN(): $A' }
|
|
240
|
+
transform:
|
|
241
|
+
AR:
|
|
242
|
+
substring: { source: $A }
|
|
243
|
+
fix: |-
|
|
244
|
+
class $CN():
|
|
245
|
+
$AR
|
|
246
|
+
";
|
|
247
|
+
|
|
248
|
+
const PY_FILE: &str = r"
|
|
249
|
+
if something:
|
|
250
|
+
class B():
|
|
251
|
+
def replace(self):
|
|
252
|
+
print(self1)
|
|
253
|
+
";
|
|
254
|
+
|
|
255
|
+
#[test]
|
|
256
|
+
fn test_transform_indent() -> Result<()> {
|
|
257
|
+
let dir = create_test_files([
|
|
258
|
+
("sgconfig.yml", CONFIG),
|
|
259
|
+
("rules/rule.yml", PY_RULE),
|
|
260
|
+
("test.py", PY_FILE),
|
|
261
|
+
])?;
|
|
262
|
+
Command::cargo_bin("ast-grep")?
|
|
263
|
+
.current_dir(dir.path())
|
|
264
|
+
.args(["scan"])
|
|
265
|
+
.assert()
|
|
266
|
+
.success()
|
|
267
|
+
.stdout(contains("print").not())
|
|
268
|
+
.stdout(contains("transform-indent"));
|
|
269
|
+
Ok(())
|
|
270
|
+
}
|
|
@@ -4,7 +4,7 @@ use crate::rule::Rule;
|
|
|
4
4
|
use crate::rule_config::RuleConfigError;
|
|
5
5
|
use crate::rule_core::RuleCoreError;
|
|
6
6
|
use crate::transform::{TransformError, Transformation};
|
|
7
|
-
use crate::
|
|
7
|
+
use crate::RuleCore;
|
|
8
8
|
|
|
9
9
|
use ast_grep_core::language::Language;
|
|
10
10
|
|
|
@@ -162,15 +162,14 @@ fn check_var_in_fix<L: Language>(vars: HashSet<&str>, fixer: &Option<Fixer<L>>)
|
|
|
162
162
|
|
|
163
163
|
pub fn check_rewriters_in_transform<L: Language>(
|
|
164
164
|
rule: &RuleCore<L>,
|
|
165
|
-
rewriters: &
|
|
165
|
+
rewriters: &HashMap<String, RuleCore<L>>,
|
|
166
166
|
) -> Result<(), RuleConfigError> {
|
|
167
|
-
let
|
|
168
|
-
if let Some(err) = check_one_rewriter_in_rule(rule, &rewriters) {
|
|
167
|
+
if let Some(err) = check_one_rewriter_in_rule(rule, rewriters) {
|
|
169
168
|
return Err(err);
|
|
170
169
|
}
|
|
171
170
|
let error = rewriters
|
|
172
171
|
.values()
|
|
173
|
-
.find_map(|rewriter| check_one_rewriter_in_rule(rewriter,
|
|
172
|
+
.find_map(|rewriter| check_one_rewriter_in_rule(rewriter, rewriters));
|
|
174
173
|
if let Some(err) = error {
|
|
175
174
|
return Err(err);
|
|
176
175
|
}
|
|
@@ -34,6 +34,7 @@ fn into_map<L: Language>(
|
|
|
34
34
|
type OrderResult<T> = Result<T, String>;
|
|
35
35
|
|
|
36
36
|
/// A struct to store information to deserialize rules.
|
|
37
|
+
#[derive(Clone)]
|
|
37
38
|
pub struct DeserializeEnv<L: Language> {
|
|
38
39
|
/// registration for global utility rules and local utility rules.
|
|
39
40
|
pub(crate) registration: RuleRegistration<L>,
|
|
@@ -153,7 +154,7 @@ impl<L: Language> DeserializeEnv<L> {
|
|
|
153
154
|
/// register utils rule in the DeserializeEnv for later usage.
|
|
154
155
|
/// N.B. This function will manage the util registration order
|
|
155
156
|
/// by their dependency. `potential_kinds` need ordered insertion.
|
|
156
|
-
pub fn
|
|
157
|
+
pub fn with_utils(
|
|
157
158
|
self,
|
|
158
159
|
utils: &HashMap<String, SerializableRule>,
|
|
159
160
|
) -> Result<Self, RuleSerializeError> {
|
|
@@ -208,12 +209,6 @@ impl<L: Language> DeserializeEnv<L> {
|
|
|
208
209
|
lang: self.lang,
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
|
-
pub fn with_rewriters(self, globals: &GlobalRules<L>) -> Self {
|
|
212
|
-
Self {
|
|
213
|
-
registration: self.registration.with_rewriters(globals),
|
|
214
|
-
lang: self.lang,
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
212
|
}
|
|
218
213
|
|
|
219
214
|
#[cfg(test)]
|
|
@@ -234,7 +229,7 @@ member-name:
|
|
|
234
229
|
kind: identifier
|
|
235
230
|
",
|
|
236
231
|
)?;
|
|
237
|
-
let env = DeserializeEnv::new(TypeScript::Tsx).
|
|
232
|
+
let env = DeserializeEnv::new(TypeScript::Tsx).with_utils(&utils)?;
|
|
238
233
|
assert_eq!(utils.keys().count(), 2);
|
|
239
234
|
let rule = from_str("matches: accessor-name").unwrap();
|
|
240
235
|
Ok((
|
|
@@ -271,7 +266,7 @@ local-rule:
|
|
|
271
266
|
",
|
|
272
267
|
)?;
|
|
273
268
|
// should not panic
|
|
274
|
-
DeserializeEnv::new(TypeScript::Tsx).
|
|
269
|
+
DeserializeEnv::new(TypeScript::Tsx).with_utils(&utils)?;
|
|
275
270
|
Ok(())
|
|
276
271
|
}
|
|
277
272
|
|
|
@@ -283,7 +278,7 @@ local-rule:
|
|
|
283
278
|
matches: local-rule
|
|
284
279
|
",
|
|
285
280
|
)?;
|
|
286
|
-
let ret = DeserializeEnv::new(TypeScript::Tsx).
|
|
281
|
+
let ret = DeserializeEnv::new(TypeScript::Tsx).with_utils(&utils);
|
|
287
282
|
assert!(ret.is_err());
|
|
288
283
|
Ok(())
|
|
289
284
|
}
|
|
@@ -302,7 +297,7 @@ local-rule-c:
|
|
|
302
297
|
- matches: local-rule-a
|
|
303
298
|
",
|
|
304
299
|
)?;
|
|
305
|
-
let ret = DeserializeEnv::new(TypeScript::Tsx).
|
|
300
|
+
let ret = DeserializeEnv::new(TypeScript::Tsx).with_utils(&utils);
|
|
306
301
|
assert!(ret.is_err());
|
|
307
302
|
Ok(())
|
|
308
303
|
}
|
|
@@ -316,7 +311,7 @@ local-rule-a:
|
|
|
316
311
|
local-rule-b:
|
|
317
312
|
matches: local-rule-a",
|
|
318
313
|
)?;
|
|
319
|
-
let ret = DeserializeEnv::new(TypeScript::Tsx).
|
|
314
|
+
let ret = DeserializeEnv::new(TypeScript::Tsx).with_utils(&utils);
|
|
320
315
|
assert!(matches!(
|
|
321
316
|
ret,
|
|
322
317
|
Err(RuleSerializeError::MatchesReference(
|