polyglot-piranha 0.3.29__tar.gz → 0.3.32__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.
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/Cargo.lock +106 -94
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/Cargo.toml +4 -2
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/PKG-INFO +1 -1
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/default_configs.rs +4 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/matches.rs +24 -5
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/rule.rs +17 -2
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/rule_test.rs +64 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/LICENSE +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/NOTICE +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/README.md +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/plugins/pyproject.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/pyproject.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/go/edges.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/go/rules.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/go/scope_config.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/java/edges.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/java/rules.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/java/scope_config.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/java_cs/edges.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/java_cs/rules.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/java_cs/scope_config.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/kt/edges.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/kt/rules.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/kt/scope_config.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/ruby/edges.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/ruby/rules.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/ruby/scope_config.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/scala/scope_config.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/swift/edges.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/swift/rules.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/swift/scope_config.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/df/README.md +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/df/analysis.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/df/mod.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/df/tag_analysis.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/df/unit_tests/tag_analysis_test.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/df/utils.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/lib.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/main.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/capture_group_patterns.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/concrete_syntax.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/edit.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/filter.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/language.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/mod.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/outgoing_edges.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/piranha_arguments.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/piranha_output.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/rule_graph.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/rule_store.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/scopes.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/source_code_unit.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/concrete_syntax_test.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/piranha_arguments_test.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/rule_graph_validation_test.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/scopes_test.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/source_code_unit_test.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/testdata/custom_builtin/edges.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/testdata/custom_builtin/rules.toml +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/mod.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_go.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_java.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_kt.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_python.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_scala.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_scm.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_strings.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_swift.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_thrift.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_ts.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_tsx.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/tests/test_piranha_yaml.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/utilities/mod.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/utilities/regex_utilities.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/utilities/tree_sitter_utilities.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/utilities/unit_tests/tree_sitter_utilities_test.rs +0 -0
- {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/utilities/unit_tests/utilities_test.rs +0 -0
@@ -52,12 +52,12 @@ dependencies = [
|
|
52
52
|
|
53
53
|
[[package]]
|
54
54
|
name = "anstyle-wincon"
|
55
|
-
version = "3.0.
|
55
|
+
version = "3.0.8"
|
56
56
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
57
|
-
checksum = "
|
57
|
+
checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa"
|
58
58
|
dependencies = [
|
59
59
|
"anstyle",
|
60
|
-
"
|
60
|
+
"once_cell_polyfill",
|
61
61
|
"windows-sys",
|
62
62
|
]
|
63
63
|
|
@@ -69,9 +69,9 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
|
|
69
69
|
|
70
70
|
[[package]]
|
71
71
|
name = "assert_cmd"
|
72
|
-
version = "2.0.
|
72
|
+
version = "2.0.17"
|
73
73
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
74
|
-
checksum = "
|
74
|
+
checksum = "2bd389a4b2970a01282ee455294913c0a43724daedcd1a24c3eb0ec1c1320b66"
|
75
75
|
dependencies = [
|
76
76
|
"anstyle",
|
77
77
|
"bstr",
|
@@ -91,15 +91,15 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
|
91
91
|
|
92
92
|
[[package]]
|
93
93
|
name = "bitflags"
|
94
|
-
version = "2.
|
94
|
+
version = "2.9.1"
|
95
95
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
96
|
-
checksum = "
|
96
|
+
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
97
97
|
|
98
98
|
[[package]]
|
99
99
|
name = "bstr"
|
100
|
-
version = "1.
|
100
|
+
version = "1.12.0"
|
101
101
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
102
|
-
checksum = "
|
102
|
+
checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4"
|
103
103
|
dependencies = [
|
104
104
|
"memchr",
|
105
105
|
"regex-automata",
|
@@ -126,9 +126,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|
126
126
|
|
127
127
|
[[package]]
|
128
128
|
name = "clap"
|
129
|
-
version = "4.5.
|
129
|
+
version = "4.5.39"
|
130
130
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
131
|
-
checksum = "
|
131
|
+
checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f"
|
132
132
|
dependencies = [
|
133
133
|
"clap_builder",
|
134
134
|
"clap_derive",
|
@@ -136,9 +136,9 @@ dependencies = [
|
|
136
136
|
|
137
137
|
[[package]]
|
138
138
|
name = "clap_builder"
|
139
|
-
version = "4.5.
|
139
|
+
version = "4.5.39"
|
140
140
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
141
|
-
checksum = "
|
141
|
+
checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51"
|
142
142
|
dependencies = [
|
143
143
|
"anstream",
|
144
144
|
"anstyle",
|
@@ -148,14 +148,14 @@ dependencies = [
|
|
148
148
|
|
149
149
|
[[package]]
|
150
150
|
name = "clap_derive"
|
151
|
-
version = "4.5.
|
151
|
+
version = "4.5.32"
|
152
152
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
153
|
-
checksum = "
|
153
|
+
checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7"
|
154
154
|
dependencies = [
|
155
155
|
"heck 0.5.0",
|
156
156
|
"proc-macro2",
|
157
157
|
"quote",
|
158
|
-
"syn 2.0.
|
158
|
+
"syn 2.0.101",
|
159
159
|
]
|
160
160
|
|
161
161
|
[[package]]
|
@@ -195,9 +195,9 @@ dependencies = [
|
|
195
195
|
|
196
196
|
[[package]]
|
197
197
|
name = "crossbeam-channel"
|
198
|
-
version = "0.5.
|
198
|
+
version = "0.5.15"
|
199
199
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
200
|
-
checksum = "
|
200
|
+
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
|
201
201
|
dependencies = [
|
202
202
|
"crossbeam-utils",
|
203
203
|
]
|
@@ -238,9 +238,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
|
238
238
|
|
239
239
|
[[package]]
|
240
240
|
name = "ctrlc"
|
241
|
-
version = "3.4.
|
241
|
+
version = "3.4.7"
|
242
242
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
243
|
-
checksum = "
|
243
|
+
checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73"
|
244
244
|
dependencies = [
|
245
245
|
"nix",
|
246
246
|
"windows-sys",
|
@@ -326,9 +326,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
|
326
326
|
|
327
327
|
[[package]]
|
328
328
|
name = "either"
|
329
|
-
version = "1.
|
329
|
+
version = "1.15.0"
|
330
330
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
331
|
-
checksum = "
|
331
|
+
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
332
332
|
|
333
333
|
[[package]]
|
334
334
|
name = "env_logger"
|
@@ -345,9 +345,9 @@ dependencies = [
|
|
345
345
|
|
346
346
|
[[package]]
|
347
347
|
name = "equivalent"
|
348
|
-
version = "1.0.
|
348
|
+
version = "1.0.2"
|
349
349
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
350
|
-
checksum = "
|
350
|
+
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
351
351
|
|
352
352
|
[[package]]
|
353
353
|
name = "float-cmp"
|
@@ -372,14 +372,14 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
|
372
372
|
|
373
373
|
[[package]]
|
374
374
|
name = "getset"
|
375
|
-
version = "0.1.
|
375
|
+
version = "0.1.5"
|
376
376
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
377
|
-
checksum = "
|
377
|
+
checksum = "f3586f256131df87204eb733da72e3d3eb4f343c639f4b7be279ac7c48baeafe"
|
378
378
|
dependencies = [
|
379
379
|
"proc-macro-error2",
|
380
380
|
"proc-macro2",
|
381
381
|
"quote",
|
382
|
-
"syn 2.0.
|
382
|
+
"syn 2.0.101",
|
383
383
|
]
|
384
384
|
|
385
385
|
[[package]]
|
@@ -390,9 +390,9 @@ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
|
|
390
390
|
|
391
391
|
[[package]]
|
392
392
|
name = "hashbrown"
|
393
|
-
version = "0.15.
|
393
|
+
version = "0.15.3"
|
394
394
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
395
|
-
checksum = "
|
395
|
+
checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3"
|
396
396
|
|
397
397
|
[[package]]
|
398
398
|
name = "heck"
|
@@ -408,15 +408,15 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
408
408
|
|
409
409
|
[[package]]
|
410
410
|
name = "hermit-abi"
|
411
|
-
version = "0.
|
411
|
+
version = "0.5.1"
|
412
412
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
413
|
-
checksum = "
|
413
|
+
checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"
|
414
414
|
|
415
415
|
[[package]]
|
416
416
|
name = "humantime"
|
417
|
-
version = "2.
|
417
|
+
version = "2.2.0"
|
418
418
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
419
|
-
checksum = "
|
419
|
+
checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f"
|
420
420
|
|
421
421
|
[[package]]
|
422
422
|
name = "ident_case"
|
@@ -426,9 +426,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
|
426
426
|
|
427
427
|
[[package]]
|
428
428
|
name = "indexmap"
|
429
|
-
version = "2.
|
429
|
+
version = "2.9.0"
|
430
430
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
431
|
-
checksum = "
|
431
|
+
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
|
432
432
|
dependencies = [
|
433
433
|
"equivalent",
|
434
434
|
"hashbrown",
|
@@ -436,15 +436,15 @@ dependencies = [
|
|
436
436
|
|
437
437
|
[[package]]
|
438
438
|
name = "indoc"
|
439
|
-
version = "2.0.
|
439
|
+
version = "2.0.6"
|
440
440
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
441
|
-
checksum = "
|
441
|
+
checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
|
442
442
|
|
443
443
|
[[package]]
|
444
444
|
name = "is-terminal"
|
445
|
-
version = "0.4.
|
445
|
+
version = "0.4.16"
|
446
446
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
447
|
-
checksum = "
|
447
|
+
checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"
|
448
448
|
dependencies = [
|
449
449
|
"hermit-abi",
|
450
450
|
"libc",
|
@@ -468,9 +468,9 @@ dependencies = [
|
|
468
468
|
|
469
469
|
[[package]]
|
470
470
|
name = "itoa"
|
471
|
-
version = "1.0.
|
471
|
+
version = "1.0.15"
|
472
472
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
473
|
-
checksum = "
|
473
|
+
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
474
474
|
|
475
475
|
[[package]]
|
476
476
|
name = "json"
|
@@ -496,15 +496,15 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
496
496
|
|
497
497
|
[[package]]
|
498
498
|
name = "libc"
|
499
|
-
version = "0.2.
|
499
|
+
version = "0.2.172"
|
500
500
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
501
|
-
checksum = "
|
501
|
+
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
|
502
502
|
|
503
503
|
[[package]]
|
504
504
|
name = "lock_api"
|
505
|
-
version = "0.4.
|
505
|
+
version = "0.4.13"
|
506
506
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
507
|
-
checksum = "
|
507
|
+
checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
|
508
508
|
dependencies = [
|
509
509
|
"autocfg",
|
510
510
|
"scopeguard",
|
@@ -512,9 +512,9 @@ dependencies = [
|
|
512
512
|
|
513
513
|
[[package]]
|
514
514
|
name = "log"
|
515
|
-
version = "0.4.
|
515
|
+
version = "0.4.27"
|
516
516
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
517
|
-
checksum = "
|
517
|
+
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
518
518
|
|
519
519
|
[[package]]
|
520
520
|
name = "memchr"
|
@@ -533,9 +533,9 @@ dependencies = [
|
|
533
533
|
|
534
534
|
[[package]]
|
535
535
|
name = "nix"
|
536
|
-
version = "0.
|
536
|
+
version = "0.30.1"
|
537
537
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
538
|
-
checksum = "
|
538
|
+
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
539
539
|
dependencies = [
|
540
540
|
"bitflags",
|
541
541
|
"cfg-if",
|
@@ -560,15 +560,21 @@ dependencies = [
|
|
560
560
|
|
561
561
|
[[package]]
|
562
562
|
name = "once_cell"
|
563
|
-
version = "1.
|
563
|
+
version = "1.21.3"
|
564
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
565
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
566
|
+
|
567
|
+
[[package]]
|
568
|
+
name = "once_cell_polyfill"
|
569
|
+
version = "1.70.1"
|
564
570
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
565
|
-
checksum = "
|
571
|
+
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
|
566
572
|
|
567
573
|
[[package]]
|
568
574
|
name = "parking_lot"
|
569
|
-
version = "0.12.
|
575
|
+
version = "0.12.4"
|
570
576
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
571
|
-
checksum = "
|
577
|
+
checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13"
|
572
578
|
dependencies = [
|
573
579
|
"lock_api",
|
574
580
|
"parking_lot_core",
|
@@ -576,9 +582,9 @@ dependencies = [
|
|
576
582
|
|
577
583
|
[[package]]
|
578
584
|
name = "parking_lot_core"
|
579
|
-
version = "0.9.
|
585
|
+
version = "0.9.11"
|
580
586
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
581
|
-
checksum = "
|
587
|
+
checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
|
582
588
|
dependencies = [
|
583
589
|
"cfg-if",
|
584
590
|
"libc",
|
@@ -589,7 +595,7 @@ dependencies = [
|
|
589
595
|
|
590
596
|
[[package]]
|
591
597
|
name = "piranha"
|
592
|
-
version = "0.3.
|
598
|
+
version = "0.3.32"
|
593
599
|
dependencies = [
|
594
600
|
"assert_cmd",
|
595
601
|
"cc",
|
@@ -632,9 +638,9 @@ dependencies = [
|
|
632
638
|
|
633
639
|
[[package]]
|
634
640
|
name = "portable-atomic"
|
635
|
-
version = "1.
|
641
|
+
version = "1.11.0"
|
636
642
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
637
|
-
checksum = "
|
643
|
+
checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
|
638
644
|
|
639
645
|
[[package]]
|
640
646
|
name = "predicates"
|
@@ -685,14 +691,14 @@ dependencies = [
|
|
685
691
|
"proc-macro-error-attr2",
|
686
692
|
"proc-macro2",
|
687
693
|
"quote",
|
688
|
-
"syn 2.0.
|
694
|
+
"syn 2.0.101",
|
689
695
|
]
|
690
696
|
|
691
697
|
[[package]]
|
692
698
|
name = "proc-macro2"
|
693
|
-
version = "1.0.
|
699
|
+
version = "1.0.95"
|
694
700
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
695
|
-
checksum = "
|
701
|
+
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
696
702
|
dependencies = [
|
697
703
|
"unicode-ident",
|
698
704
|
]
|
@@ -755,7 +761,7 @@ dependencies = [
|
|
755
761
|
"proc-macro2",
|
756
762
|
"pyo3-macros-backend",
|
757
763
|
"quote",
|
758
|
-
"syn 2.0.
|
764
|
+
"syn 2.0.101",
|
759
765
|
]
|
760
766
|
|
761
767
|
[[package]]
|
@@ -768,14 +774,14 @@ dependencies = [
|
|
768
774
|
"proc-macro2",
|
769
775
|
"pyo3-build-config",
|
770
776
|
"quote",
|
771
|
-
"syn 2.0.
|
777
|
+
"syn 2.0.101",
|
772
778
|
]
|
773
779
|
|
774
780
|
[[package]]
|
775
781
|
name = "quote"
|
776
|
-
version = "1.0.
|
782
|
+
version = "1.0.40"
|
777
783
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
778
|
-
checksum = "
|
784
|
+
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
779
785
|
dependencies = [
|
780
786
|
"proc-macro2",
|
781
787
|
]
|
@@ -839,9 +845,9 @@ dependencies = [
|
|
839
845
|
|
840
846
|
[[package]]
|
841
847
|
name = "redox_syscall"
|
842
|
-
version = "0.5.
|
848
|
+
version = "0.5.12"
|
843
849
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
844
|
-
checksum = "
|
850
|
+
checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af"
|
845
851
|
dependencies = [
|
846
852
|
"bitflags",
|
847
853
|
]
|
@@ -886,9 +892,9 @@ dependencies = [
|
|
886
892
|
|
887
893
|
[[package]]
|
888
894
|
name = "ryu"
|
889
|
-
version = "1.0.
|
895
|
+
version = "1.0.20"
|
890
896
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
891
|
-
checksum = "
|
897
|
+
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
892
898
|
|
893
899
|
[[package]]
|
894
900
|
name = "scopeguard"
|
@@ -898,29 +904,29 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
|
898
904
|
|
899
905
|
[[package]]
|
900
906
|
name = "serde"
|
901
|
-
version = "1.0.
|
907
|
+
version = "1.0.219"
|
902
908
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
903
|
-
checksum = "
|
909
|
+
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
904
910
|
dependencies = [
|
905
911
|
"serde_derive",
|
906
912
|
]
|
907
913
|
|
908
914
|
[[package]]
|
909
915
|
name = "serde_derive"
|
910
|
-
version = "1.0.
|
916
|
+
version = "1.0.219"
|
911
917
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
912
|
-
checksum = "
|
918
|
+
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
913
919
|
dependencies = [
|
914
920
|
"proc-macro2",
|
915
921
|
"quote",
|
916
|
-
"syn 2.0.
|
922
|
+
"syn 2.0.101",
|
917
923
|
]
|
918
924
|
|
919
925
|
[[package]]
|
920
926
|
name = "serde_json"
|
921
|
-
version = "1.0.
|
927
|
+
version = "1.0.140"
|
922
928
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
923
|
-
checksum = "
|
929
|
+
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
924
930
|
dependencies = [
|
925
931
|
"itoa",
|
926
932
|
"memchr",
|
@@ -939,9 +945,9 @@ dependencies = [
|
|
939
945
|
|
940
946
|
[[package]]
|
941
947
|
name = "smallvec"
|
942
|
-
version = "1.
|
948
|
+
version = "1.15.0"
|
943
949
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
944
|
-
checksum = "
|
950
|
+
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
|
945
951
|
|
946
952
|
[[package]]
|
947
953
|
name = "strsim"
|
@@ -968,9 +974,9 @@ dependencies = [
|
|
968
974
|
|
969
975
|
[[package]]
|
970
976
|
name = "syn"
|
971
|
-
version = "2.0.
|
977
|
+
version = "2.0.101"
|
972
978
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
973
|
-
checksum = "
|
979
|
+
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
974
980
|
dependencies = [
|
975
981
|
"proc-macro2",
|
976
982
|
"quote",
|
@@ -1010,9 +1016,9 @@ checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"
|
|
1010
1016
|
|
1011
1017
|
[[package]]
|
1012
1018
|
name = "toml"
|
1013
|
-
version = "0.8.
|
1019
|
+
version = "0.8.22"
|
1014
1020
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1015
|
-
checksum = "
|
1021
|
+
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
|
1016
1022
|
dependencies = [
|
1017
1023
|
"serde",
|
1018
1024
|
"serde_spanned",
|
@@ -1022,26 +1028,33 @@ dependencies = [
|
|
1022
1028
|
|
1023
1029
|
[[package]]
|
1024
1030
|
name = "toml_datetime"
|
1025
|
-
version = "0.6.
|
1031
|
+
version = "0.6.9"
|
1026
1032
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1027
|
-
checksum = "
|
1033
|
+
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
|
1028
1034
|
dependencies = [
|
1029
1035
|
"serde",
|
1030
1036
|
]
|
1031
1037
|
|
1032
1038
|
[[package]]
|
1033
1039
|
name = "toml_edit"
|
1034
|
-
version = "0.22.
|
1040
|
+
version = "0.22.26"
|
1035
1041
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1036
|
-
checksum = "
|
1042
|
+
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
|
1037
1043
|
dependencies = [
|
1038
1044
|
"indexmap",
|
1039
1045
|
"serde",
|
1040
1046
|
"serde_spanned",
|
1041
1047
|
"toml_datetime",
|
1048
|
+
"toml_write",
|
1042
1049
|
"winnow",
|
1043
1050
|
]
|
1044
1051
|
|
1052
|
+
[[package]]
|
1053
|
+
name = "toml_write"
|
1054
|
+
version = "0.1.1"
|
1055
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1056
|
+
checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
|
1057
|
+
|
1045
1058
|
[[package]]
|
1046
1059
|
name = "tree-sitter"
|
1047
1060
|
version = "0.20.10"
|
@@ -1074,8 +1087,7 @@ dependencies = [
|
|
1074
1087
|
[[package]]
|
1075
1088
|
name = "tree-sitter-kotlin"
|
1076
1089
|
version = "0.3.5"
|
1077
|
-
source = "
|
1078
|
-
checksum = "8df217a0e1fec649f3e13157de932439f3d37ea4e265038dd0873971ef56e726"
|
1090
|
+
source = "git+https://github.com/danieltrt/tree-sitter-kotlin?rev=8eb82b294900b66965ecfe39cdcbb8b16c99ff71#8eb82b294900b66965ecfe39cdcbb8b16c99ff71"
|
1079
1091
|
dependencies = [
|
1080
1092
|
"cc",
|
1081
1093
|
"tree-sitter",
|
@@ -1180,15 +1192,15 @@ dependencies = [
|
|
1180
1192
|
|
1181
1193
|
[[package]]
|
1182
1194
|
name = "unicode-ident"
|
1183
|
-
version = "1.0.
|
1195
|
+
version = "1.0.18"
|
1184
1196
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1185
|
-
checksum = "
|
1197
|
+
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
1186
1198
|
|
1187
1199
|
[[package]]
|
1188
1200
|
name = "unindent"
|
1189
|
-
version = "0.2.
|
1201
|
+
version = "0.2.4"
|
1190
1202
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1191
|
-
checksum = "
|
1203
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
1192
1204
|
|
1193
1205
|
[[package]]
|
1194
1206
|
name = "utf8parse"
|
@@ -1311,9 +1323,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
1311
1323
|
|
1312
1324
|
[[package]]
|
1313
1325
|
name = "winnow"
|
1314
|
-
version = "0.7.
|
1326
|
+
version = "0.7.10"
|
1315
1327
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1316
|
-
checksum = "
|
1328
|
+
checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec"
|
1317
1329
|
dependencies = [
|
1318
1330
|
"memchr",
|
1319
1331
|
]
|
@@ -2,7 +2,7 @@
|
|
2
2
|
authors = ["Uber Technologies Inc."]
|
3
3
|
name = "piranha"
|
4
4
|
description = "Polyglot Piranha is a library for performing structural find and replace with deep cleanup."
|
5
|
-
version = "0.3.
|
5
|
+
version = "0.3.32"
|
6
6
|
edition = "2021"
|
7
7
|
include = ["pyproject.toml", "src/"]
|
8
8
|
exclude = ["legacy"]
|
@@ -47,7 +47,9 @@ serde_json = "1.0.82"
|
|
47
47
|
ctrlc = "3.4"
|
48
48
|
|
49
49
|
# TODO: Update if we upgrade tree-sitter to >=0.21
|
50
|
-
|
50
|
+
# Kotlin's grammar needs to fix the way it parses unary expressions (currently -a + b gets parsed as - (a +b)).
|
51
|
+
# Once we upstream the fix, we can point to the official version.
|
52
|
+
tree-sitter-kotlin = { git = "https://github.com/danieltrt/tree-sitter-kotlin", rev = "8eb82b294900b66965ecfe39cdcbb8b16c99ff71" }
|
51
53
|
tree-sitter-java = "0.20.2"
|
52
54
|
# TODO: Update after: https://github.com/alex-pinkus/tree-sitter-swift/issues/278 resolves
|
53
55
|
tree-sitter-swift = { git = "https://github.com/satyam1749/tree-sitter-swift.git", rev = "08a28993599f1968bc81631a89690503e1db7704" }
|
@@ -18,6 +18,7 @@ use getset::{Getters, MutGetters};
|
|
18
18
|
use itertools::Itertools;
|
19
19
|
use log::trace;
|
20
20
|
use pyo3::prelude::{pyclass, pymethods};
|
21
|
+
use regex::Regex;
|
21
22
|
use serde_derive::{Deserialize, Serialize};
|
22
23
|
use tree_sitter::Node;
|
23
24
|
|
@@ -120,9 +121,10 @@ impl Match {
|
|
120
121
|
// Populates the leading and trailing comma and comment ranges for the match.
|
121
122
|
fn populate_associated_elements(
|
122
123
|
&mut self, node: &Node, code: &String, piranha_arguments: &PiranhaArguments,
|
124
|
+
compiled_regexes: Vec<Regex>,
|
123
125
|
) {
|
124
|
-
self.get_associated_elements(node, code, piranha_arguments, true);
|
125
|
-
self.get_associated_elements(node, code, piranha_arguments, false);
|
126
|
+
self.get_associated_elements(node, code, piranha_arguments, true, &compiled_regexes);
|
127
|
+
self.get_associated_elements(node, code, piranha_arguments, false, &compiled_regexes);
|
126
128
|
self.get_associated_leading_empty_lines(node, code);
|
127
129
|
}
|
128
130
|
|
@@ -182,6 +184,7 @@ impl Match {
|
|
182
184
|
/// We currently capture leading and trailing comments and commas.
|
183
185
|
fn get_associated_elements(
|
184
186
|
&mut self, node: &Node, code: &String, piranha_arguments: &PiranhaArguments, trailing: bool,
|
187
|
+
keep_comment_regexes: &[Regex],
|
185
188
|
) {
|
186
189
|
let mut current_node = *node;
|
187
190
|
let mut buf = *piranha_arguments.cleanup_comments_buffer();
|
@@ -200,8 +203,13 @@ impl Match {
|
|
200
203
|
current_node = sibling;
|
201
204
|
continue; // Continue the inner loop (i.e. evaluate next sibling)
|
202
205
|
} else if self._is_comment_safe_to_delete(&sibling, node, piranha_arguments, trailing) {
|
203
|
-
|
204
|
-
|
206
|
+
let comment_text = sibling.utf8_text(code.as_bytes()).unwrap();
|
207
|
+
if !keep_comment_regexes
|
208
|
+
.iter()
|
209
|
+
.any(|re| re.is_match(comment_text))
|
210
|
+
{
|
211
|
+
self.associated_comments.push(sibling.range().into());
|
212
|
+
}
|
205
213
|
current_node = sibling;
|
206
214
|
continue; // Continue the inner loop (i.e. evaluate next sibling)
|
207
215
|
}
|
@@ -490,7 +498,18 @@ impl SourceCodeUnit {
|
|
490
498
|
p_match.range().end_byte,
|
491
499
|
);
|
492
500
|
if self.is_satisfied(matched_node, rule, p_match.matches(), rule_store) {
|
493
|
-
|
501
|
+
let compiled_regexes: Vec<Regex> = rule
|
502
|
+
.rule()
|
503
|
+
.keep_comment_regexes()
|
504
|
+
.iter()
|
505
|
+
.filter_map(|pattern| Regex::new(pattern).ok())
|
506
|
+
.collect();
|
507
|
+
p_match.populate_associated_elements(
|
508
|
+
&matched_node,
|
509
|
+
self.code(),
|
510
|
+
self.piranha_arguments(),
|
511
|
+
compiled_regexes,
|
512
|
+
);
|
494
513
|
trace!("Found match {:#?}", p_match);
|
495
514
|
output.push(p_match.clone());
|
496
515
|
}
|
@@ -25,8 +25,9 @@ use crate::utilities::Instantiate;
|
|
25
25
|
use super::{
|
26
26
|
capture_group_patterns::CGPattern,
|
27
27
|
default_configs::{
|
28
|
-
default_filters, default_groups, default_holes, default_is_seed_rule,
|
29
|
-
|
28
|
+
default_filters, default_groups, default_holes, default_is_seed_rule,
|
29
|
+
default_keep_comment_regexes, default_query, default_replace, default_replace_idx,
|
30
|
+
default_replace_node, default_rule_name,
|
30
31
|
},
|
31
32
|
filter::Filter,
|
32
33
|
Validator,
|
@@ -95,6 +96,13 @@ pub struct Rule {
|
|
95
96
|
#[get = "pub"]
|
96
97
|
#[pyo3(get)]
|
97
98
|
is_seed_rule: bool,
|
99
|
+
|
100
|
+
/// Marks comments as deletable
|
101
|
+
#[builder(default = "default_keep_comment_regexes()")]
|
102
|
+
#[serde(default = "default_keep_comment_regexes")]
|
103
|
+
#[get = "pub"]
|
104
|
+
#[pyo3(get)]
|
105
|
+
keep_comment_regexes: HashSet<String>,
|
98
106
|
}
|
99
107
|
|
100
108
|
impl Rule {
|
@@ -141,6 +149,7 @@ macro_rules! piranha_rule {
|
|
141
149
|
$(, is_seed_rule = $is_seed_rule:expr)?
|
142
150
|
$(, groups = [$($group_name: expr)*])?
|
143
151
|
$(, filters = [$($filter:tt)*])?
|
152
|
+
$(, keep_comment_regexes = [$($rgex: expr)*])?
|
144
153
|
) => {
|
145
154
|
$crate::models::rule::RuleBuilder::default()
|
146
155
|
.name($name.to_string())
|
@@ -152,6 +161,7 @@ macro_rules! piranha_rule {
|
|
152
161
|
$(.holes(std::collections::HashSet::from([$($hole.to_string(),)*])))?
|
153
162
|
$(.groups(std::collections::HashSet::from([$($group_name.to_string(),)*])))?
|
154
163
|
$(.filters(std::collections::HashSet::from([$($filter)*])))?
|
164
|
+
$(.keep_comment_regexes(std::collections::HashSet::from([$($rgex.to_string(),)*])))?
|
155
165
|
.build().unwrap()
|
156
166
|
};
|
157
167
|
}
|
@@ -163,6 +173,7 @@ impl Rule {
|
|
163
173
|
name: String, query: Option<String>, replace: Option<String>, replace_idx: Option<u8>,
|
164
174
|
replace_node: Option<String>, holes: Option<HashSet<String>>, groups: Option<HashSet<String>>,
|
165
175
|
filters: Option<HashSet<Filter>>, is_seed_rule: Option<bool>,
|
176
|
+
keep_comment_regexes: Option<HashSet<String>>,
|
166
177
|
) -> Self {
|
167
178
|
let mut rule_builder = RuleBuilder::default();
|
168
179
|
|
@@ -199,6 +210,10 @@ impl Rule {
|
|
199
210
|
rule_builder.is_seed_rule(is_seed_rule);
|
200
211
|
}
|
201
212
|
|
213
|
+
if let Some(keep_comment_regexes) = keep_comment_regexes {
|
214
|
+
rule_builder.keep_comment_regexes(keep_comment_regexes);
|
215
|
+
}
|
216
|
+
|
202
217
|
rule_builder.build().unwrap()
|
203
218
|
}
|
204
219
|
|
@@ -235,6 +235,7 @@ fn test_get_edit_for_context_positive() {
|
|
235
235
|
let mut rule_store = RuleStore::default();
|
236
236
|
let args = PiranhaArgumentsBuilder::default()
|
237
237
|
.paths_to_codebase(vec![UNUSED_CODE_PATH.to_string()])
|
238
|
+
.language(PiranhaLanguage::from(JAVA))
|
238
239
|
.build();
|
239
240
|
let mut parser = args.language().parser();
|
240
241
|
|
@@ -284,6 +285,7 @@ fn test_get_edit_for_context_negative() {
|
|
284
285
|
|
285
286
|
let args = PiranhaArgumentsBuilder::default()
|
286
287
|
.paths_to_codebase(vec![UNUSED_CODE_PATH.to_string()])
|
288
|
+
.language(PiranhaLanguage::from(JAVA))
|
287
289
|
.build();
|
288
290
|
let mut parser = args.language().parser();
|
289
291
|
|
@@ -381,3 +383,65 @@ fn test_satisfies_filter_not_enclosing_node_negative() {
|
|
381
383
|
|result| result,
|
382
384
|
);
|
383
385
|
}
|
386
|
+
|
387
|
+
/// Tests whether comments are preserved when delete_comments is set to false
|
388
|
+
#[test]
|
389
|
+
fn test_rule_delete_comments() {
|
390
|
+
println!("Starting test...");
|
391
|
+
let _rule = piranha_rule! {
|
392
|
+
name= "delete_invoc",
|
393
|
+
query= "((method_invocation) @m (#eq? @m \"variable.set_value(true)\"))",
|
394
|
+
replace_node = "m",
|
395
|
+
replace = "",
|
396
|
+
keep_comment_regexes = ["// Given .*"]
|
397
|
+
};
|
398
|
+
|
399
|
+
let rule = InstantiatedRule::new(&_rule, &HashMap::new());
|
400
|
+
let source_code = "class Test {
|
401
|
+
public void foobar(){
|
402
|
+
// Given something
|
403
|
+
// This is an explanatory comment
|
404
|
+
// This is another explanatory comment
|
405
|
+
variable.set_value(true);
|
406
|
+
other_variable.set_value(false);
|
407
|
+
|
408
|
+
// When
|
409
|
+
var result = data.Something();
|
410
|
+
|
411
|
+
// Then
|
412
|
+
assertTrue(\"This is a test\", result);
|
413
|
+
}
|
414
|
+
}";
|
415
|
+
|
416
|
+
let mut rule_store = RuleStore::default();
|
417
|
+
|
418
|
+
let args = PiranhaArgumentsBuilder::default()
|
419
|
+
.paths_to_codebase(vec![UNUSED_CODE_PATH.to_string()])
|
420
|
+
.language(PiranhaLanguage::from(JAVA))
|
421
|
+
.cleanup_comments(true)
|
422
|
+
.build();
|
423
|
+
let mut parser = args.language().parser();
|
424
|
+
|
425
|
+
let mut source_code_unit = SourceCodeUnit::new(
|
426
|
+
&mut parser,
|
427
|
+
source_code.to_string(),
|
428
|
+
&HashMap::new(),
|
429
|
+
PathBuf::new().as_path(),
|
430
|
+
&args,
|
431
|
+
);
|
432
|
+
let node = source_code_unit.root_node();
|
433
|
+
let matches = source_code_unit.get_matches(&rule, &mut rule_store, node, true);
|
434
|
+
assert!(!matches.is_empty());
|
435
|
+
|
436
|
+
let edit = source_code_unit.get_edit(&rule, &mut rule_store, node, true);
|
437
|
+
assert!(edit.is_some());
|
438
|
+
let edit = edit.unwrap();
|
439
|
+
// Apply the edit to the source code unit
|
440
|
+
source_code_unit.apply_edit(&edit, &mut parser);
|
441
|
+
|
442
|
+
let edited_code = source_code_unit.code();
|
443
|
+
assert!(edited_code.contains("// Given something"));
|
444
|
+
assert!(!edited_code.contains("// This is another explanatory comment"));
|
445
|
+
assert!(!edited_code.contains("// This is an explanatory comment"));
|
446
|
+
assert!(!edited_code.contains("variable.set_value(true);"));
|
447
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/java/scope_config.toml
RENAMED
File without changes
|
File without changes
|
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/java_cs/scope_config.toml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/ruby/scope_config.toml
RENAMED
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/scala/scope_config.toml
RENAMED
File without changes
|
File without changes
|
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/cleanup_rules/swift/scope_config.toml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/concrete_syntax_test.rs
RENAMED
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/piranha_arguments_test.rs
RENAMED
File without changes
|
File without changes
|
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/models/unit_tests/source_code_unit_test.rs
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{polyglot_piranha-0.3.29 → polyglot_piranha-0.3.32}/src/utilities/unit_tests/utilities_test.rs
RENAMED
File without changes
|