polyglot-piranha 0.3.29__tar.gz → 0.3.31__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.
Files changed (77) hide show
  1. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/Cargo.lock +99 -86
  2. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/Cargo.toml +1 -1
  3. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/PKG-INFO +1 -1
  4. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/default_configs.rs +4 -0
  5. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/matches.rs +13 -4
  6. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/rule.rs +16 -3
  7. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/unit_tests/rule_test.rs +65 -0
  8. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/LICENSE +0 -0
  9. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/NOTICE +0 -0
  10. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/README.md +0 -0
  11. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/plugins/pyproject.toml +0 -0
  12. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/pyproject.toml +0 -0
  13. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/go/edges.toml +0 -0
  14. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/go/rules.toml +0 -0
  15. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/go/scope_config.toml +0 -0
  16. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/java/edges.toml +0 -0
  17. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/java/rules.toml +0 -0
  18. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/java/scope_config.toml +0 -0
  19. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/java_cs/edges.toml +0 -0
  20. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/java_cs/rules.toml +0 -0
  21. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/java_cs/scope_config.toml +0 -0
  22. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/kt/edges.toml +0 -0
  23. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/kt/rules.toml +0 -0
  24. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/kt/scope_config.toml +0 -0
  25. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/ruby/edges.toml +0 -0
  26. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/ruby/rules.toml +0 -0
  27. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/ruby/scope_config.toml +0 -0
  28. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/scala/scope_config.toml +0 -0
  29. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/swift/edges.toml +0 -0
  30. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/swift/rules.toml +0 -0
  31. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/cleanup_rules/swift/scope_config.toml +0 -0
  32. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/df/README.md +0 -0
  33. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/df/analysis.rs +0 -0
  34. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/df/mod.rs +0 -0
  35. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/df/tag_analysis.rs +0 -0
  36. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/df/unit_tests/tag_analysis_test.rs +0 -0
  37. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/df/utils.rs +0 -0
  38. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/lib.rs +0 -0
  39. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/main.rs +0 -0
  40. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/capture_group_patterns.rs +0 -0
  41. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/concrete_syntax.rs +0 -0
  42. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/edit.rs +0 -0
  43. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/filter.rs +0 -0
  44. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/language.rs +0 -0
  45. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/mod.rs +0 -0
  46. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/outgoing_edges.rs +0 -0
  47. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/piranha_arguments.rs +0 -0
  48. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/piranha_output.rs +0 -0
  49. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/rule_graph.rs +0 -0
  50. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/rule_store.rs +0 -0
  51. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/scopes.rs +0 -0
  52. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/source_code_unit.rs +0 -0
  53. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/unit_tests/concrete_syntax_test.rs +0 -0
  54. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/unit_tests/piranha_arguments_test.rs +0 -0
  55. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/unit_tests/rule_graph_validation_test.rs +0 -0
  56. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/unit_tests/scopes_test.rs +0 -0
  57. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/unit_tests/source_code_unit_test.rs +0 -0
  58. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/unit_tests/testdata/custom_builtin/edges.toml +0 -0
  59. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/models/unit_tests/testdata/custom_builtin/rules.toml +0 -0
  60. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/mod.rs +0 -0
  61. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_go.rs +0 -0
  62. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_java.rs +0 -0
  63. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_kt.rs +0 -0
  64. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_python.rs +0 -0
  65. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_scala.rs +0 -0
  66. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_scm.rs +0 -0
  67. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_strings.rs +0 -0
  68. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_swift.rs +0 -0
  69. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_thrift.rs +0 -0
  70. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_ts.rs +0 -0
  71. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_tsx.rs +0 -0
  72. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/tests/test_piranha_yaml.rs +0 -0
  73. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/utilities/mod.rs +0 -0
  74. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/utilities/regex_utilities.rs +0 -0
  75. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/utilities/tree_sitter_utilities.rs +0 -0
  76. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/src/utilities/unit_tests/tree_sitter_utilities_test.rs +0 -0
  77. {polyglot_piranha-0.3.29 → polyglot_piranha-0.3.31}/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.7"
55
+ version = "3.0.8"
56
56
  source = "registry+https://github.com/rust-lang/crates.io-index"
57
- checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
57
+ checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa"
58
58
  dependencies = [
59
59
  "anstyle",
60
- "once_cell",
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.16"
72
+ version = "2.0.17"
73
73
  source = "registry+https://github.com/rust-lang/crates.io-index"
74
- checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d"
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.8.0"
94
+ version = "2.9.1"
95
95
  source = "registry+https://github.com/rust-lang/crates.io-index"
96
- checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
96
+ checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
97
97
 
98
98
  [[package]]
99
99
  name = "bstr"
100
- version = "1.11.3"
100
+ version = "1.12.0"
101
101
  source = "registry+https://github.com/rust-lang/crates.io-index"
102
- checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0"
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.28"
129
+ version = "4.5.38"
130
130
  source = "registry+https://github.com/rust-lang/crates.io-index"
131
- checksum = "3e77c3243bd94243c03672cb5154667347c457ca271254724f9f393aee1c05ff"
131
+ checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000"
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.27"
139
+ version = "4.5.38"
140
140
  source = "registry+https://github.com/rust-lang/crates.io-index"
141
- checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7"
141
+ checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120"
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.28"
151
+ version = "4.5.32"
152
152
  source = "registry+https://github.com/rust-lang/crates.io-index"
153
- checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed"
153
+ checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7"
154
154
  dependencies = [
155
155
  "heck 0.5.0",
156
156
  "proc-macro2",
157
157
  "quote",
158
- "syn 2.0.98",
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.14"
198
+ version = "0.5.15"
199
199
  source = "registry+https://github.com/rust-lang/crates.io-index"
200
- checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471"
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.5"
241
+ version = "3.4.7"
242
242
  source = "registry+https://github.com/rust-lang/crates.io-index"
243
- checksum = "90eeab0aa92f3f9b4e87f258c72b139c207d251f9cbc1080a0086b86a8870dd3"
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.13.0"
329
+ version = "1.15.0"
330
330
  source = "registry+https://github.com/rust-lang/crates.io-index"
331
- checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
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.1"
348
+ version = "1.0.2"
349
349
  source = "registry+https://github.com/rust-lang/crates.io-index"
350
- checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
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.4"
375
+ version = "0.1.5"
376
376
  source = "registry+https://github.com/rust-lang/crates.io-index"
377
- checksum = "eded738faa0e88d3abc9d1a13cb11adc2073c400969eeb8793cf7132589959fc"
377
+ checksum = "f3586f256131df87204eb733da72e3d3eb4f343c639f4b7be279ac7c48baeafe"
378
378
  dependencies = [
379
379
  "proc-macro-error2",
380
380
  "proc-macro2",
381
381
  "quote",
382
- "syn 2.0.98",
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.2"
393
+ version = "0.15.3"
394
394
  source = "registry+https://github.com/rust-lang/crates.io-index"
395
- checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
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.4.0"
411
+ version = "0.5.1"
412
412
  source = "registry+https://github.com/rust-lang/crates.io-index"
413
- checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
413
+ checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"
414
414
 
415
415
  [[package]]
416
416
  name = "humantime"
417
- version = "2.1.0"
417
+ version = "2.2.0"
418
418
  source = "registry+https://github.com/rust-lang/crates.io-index"
419
- checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
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.7.1"
429
+ version = "2.9.0"
430
430
  source = "registry+https://github.com/rust-lang/crates.io-index"
431
- checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652"
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.5"
439
+ version = "2.0.6"
440
440
  source = "registry+https://github.com/rust-lang/crates.io-index"
441
- checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
441
+ checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
442
442
 
443
443
  [[package]]
444
444
  name = "is-terminal"
445
- version = "0.4.15"
445
+ version = "0.4.16"
446
446
  source = "registry+https://github.com/rust-lang/crates.io-index"
447
- checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37"
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.14"
471
+ version = "1.0.15"
472
472
  source = "registry+https://github.com/rust-lang/crates.io-index"
473
- checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
473
+ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
474
474
 
475
475
  [[package]]
476
476
  name = "json"
@@ -496,9 +496,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
496
496
 
497
497
  [[package]]
498
498
  name = "libc"
499
- version = "0.2.169"
499
+ version = "0.2.172"
500
500
  source = "registry+https://github.com/rust-lang/crates.io-index"
501
- checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
501
+ checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
502
502
 
503
503
  [[package]]
504
504
  name = "lock_api"
@@ -512,9 +512,9 @@ dependencies = [
512
512
 
513
513
  [[package]]
514
514
  name = "log"
515
- version = "0.4.25"
515
+ version = "0.4.27"
516
516
  source = "registry+https://github.com/rust-lang/crates.io-index"
517
- checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
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.29.0"
536
+ version = "0.30.1"
537
537
  source = "registry+https://github.com/rust-lang/crates.io-index"
538
- checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
538
+ checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
539
539
  dependencies = [
540
540
  "bitflags",
541
541
  "cfg-if",
@@ -560,9 +560,15 @@ dependencies = [
560
560
 
561
561
  [[package]]
562
562
  name = "once_cell"
563
- version = "1.20.2"
563
+ version = "1.21.3"
564
564
  source = "registry+https://github.com/rust-lang/crates.io-index"
565
- checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
565
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
566
+
567
+ [[package]]
568
+ name = "once_cell_polyfill"
569
+ version = "1.70.1"
570
+ source = "registry+https://github.com/rust-lang/crates.io-index"
571
+ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
566
572
 
567
573
  [[package]]
568
574
  name = "parking_lot"
@@ -589,7 +595,7 @@ dependencies = [
589
595
 
590
596
  [[package]]
591
597
  name = "piranha"
592
- version = "0.3.29"
598
+ version = "0.3.31"
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.10.0"
641
+ version = "1.11.0"
636
642
  source = "registry+https://github.com/rust-lang/crates.io-index"
637
- checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
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.98",
694
+ "syn 2.0.101",
689
695
  ]
690
696
 
691
697
  [[package]]
692
698
  name = "proc-macro2"
693
- version = "1.0.93"
699
+ version = "1.0.95"
694
700
  source = "registry+https://github.com/rust-lang/crates.io-index"
695
- checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
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.98",
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.98",
777
+ "syn 2.0.101",
772
778
  ]
773
779
 
774
780
  [[package]]
775
781
  name = "quote"
776
- version = "1.0.38"
782
+ version = "1.0.40"
777
783
  source = "registry+https://github.com/rust-lang/crates.io-index"
778
- checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
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.8"
848
+ version = "0.5.12"
843
849
  source = "registry+https://github.com/rust-lang/crates.io-index"
844
- checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
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.19"
895
+ version = "1.0.20"
890
896
  source = "registry+https://github.com/rust-lang/crates.io-index"
891
- checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd"
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.217"
907
+ version = "1.0.219"
902
908
  source = "registry+https://github.com/rust-lang/crates.io-index"
903
- checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
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.217"
916
+ version = "1.0.219"
911
917
  source = "registry+https://github.com/rust-lang/crates.io-index"
912
- checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
918
+ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
913
919
  dependencies = [
914
920
  "proc-macro2",
915
921
  "quote",
916
- "syn 2.0.98",
922
+ "syn 2.0.101",
917
923
  ]
918
924
 
919
925
  [[package]]
920
926
  name = "serde_json"
921
- version = "1.0.138"
927
+ version = "1.0.140"
922
928
  source = "registry+https://github.com/rust-lang/crates.io-index"
923
- checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949"
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.13.2"
948
+ version = "1.15.0"
943
949
  source = "registry+https://github.com/rust-lang/crates.io-index"
944
- checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
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.98"
977
+ version = "2.0.101"
972
978
  source = "registry+https://github.com/rust-lang/crates.io-index"
973
- checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
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.19"
1019
+ version = "0.8.22"
1014
1020
  source = "registry+https://github.com/rust-lang/crates.io-index"
1015
- checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
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.8"
1031
+ version = "0.6.9"
1026
1032
  source = "registry+https://github.com/rust-lang/crates.io-index"
1027
- checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
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.23"
1040
+ version = "0.22.26"
1035
1041
  source = "registry+https://github.com/rust-lang/crates.io-index"
1036
- checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
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"
@@ -1180,15 +1193,15 @@ dependencies = [
1180
1193
 
1181
1194
  [[package]]
1182
1195
  name = "unicode-ident"
1183
- version = "1.0.16"
1196
+ version = "1.0.18"
1184
1197
  source = "registry+https://github.com/rust-lang/crates.io-index"
1185
- checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
1198
+ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
1186
1199
 
1187
1200
  [[package]]
1188
1201
  name = "unindent"
1189
- version = "0.2.3"
1202
+ version = "0.2.4"
1190
1203
  source = "registry+https://github.com/rust-lang/crates.io-index"
1191
- checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
1204
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
1192
1205
 
1193
1206
  [[package]]
1194
1207
  name = "utf8parse"
@@ -1311,9 +1324,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
1311
1324
 
1312
1325
  [[package]]
1313
1326
  name = "winnow"
1314
- version = "0.7.1"
1327
+ version = "0.7.10"
1315
1328
  source = "registry+https://github.com/rust-lang/crates.io-index"
1316
- checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f"
1329
+ checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec"
1317
1330
  dependencies = [
1318
1331
  "memchr",
1319
1332
  ]
@@ -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.29"
5
+ version = "0.3.31"
6
6
  edition = "2021"
7
7
  include = ["pyproject.toml", "src/"]
8
8
  exclude = ["legacy"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyglot_piranha
3
- Version: 0.3.29
3
+ Version: 0.3.31
4
4
  License-File: LICENSE
5
5
  License-File: NOTICE
6
6
  Summary: Polyglot Piranha is a library for performing structural find and replace with deep cleanup.
@@ -192,6 +192,10 @@ pub(crate) fn default_is_seed_rule() -> bool {
192
192
  true
193
193
  }
194
194
 
195
+ pub(crate) fn default_delete_comments() -> bool {
196
+ true
197
+ }
198
+
195
199
  pub(crate) fn default_allow_dirty_ast() -> bool {
196
200
  false
197
201
  }
@@ -120,9 +120,10 @@ impl Match {
120
120
  // Populates the leading and trailing comma and comment ranges for the match.
121
121
  fn populate_associated_elements(
122
122
  &mut self, node: &Node, code: &String, piranha_arguments: &PiranhaArguments,
123
+ delete_comments: bool,
123
124
  ) {
124
- self.get_associated_elements(node, code, piranha_arguments, true);
125
- self.get_associated_elements(node, code, piranha_arguments, false);
125
+ self.get_associated_elements(node, code, piranha_arguments, true, delete_comments);
126
+ self.get_associated_elements(node, code, piranha_arguments, false, delete_comments);
126
127
  self.get_associated_leading_empty_lines(node, code);
127
128
  }
128
129
 
@@ -182,6 +183,7 @@ impl Match {
182
183
  /// We currently capture leading and trailing comments and commas.
183
184
  fn get_associated_elements(
184
185
  &mut self, node: &Node, code: &String, piranha_arguments: &PiranhaArguments, trailing: bool,
186
+ delete_comments: bool,
185
187
  ) {
186
188
  let mut current_node = *node;
187
189
  let mut buf = *piranha_arguments.cleanup_comments_buffer();
@@ -199,7 +201,9 @@ impl Match {
199
201
  self.associated_comma = Some(sibling.range().into());
200
202
  current_node = sibling;
201
203
  continue; // Continue the inner loop (i.e. evaluate next sibling)
202
- } else if self._is_comment_safe_to_delete(&sibling, node, piranha_arguments, trailing) {
204
+ } else if delete_comments
205
+ && self._is_comment_safe_to_delete(&sibling, node, piranha_arguments, trailing)
206
+ {
203
207
  // Add the comment to the associated matches
204
208
  self.associated_comments.push(sibling.range().into());
205
209
  current_node = sibling;
@@ -490,7 +494,12 @@ impl SourceCodeUnit {
490
494
  p_match.range().end_byte,
491
495
  );
492
496
  if self.is_satisfied(matched_node, rule, p_match.matches(), rule_store) {
493
- p_match.populate_associated_elements(&matched_node, self.code(), self.piranha_arguments());
497
+ p_match.populate_associated_elements(
498
+ &matched_node,
499
+ self.code(),
500
+ self.piranha_arguments(),
501
+ *rule.rule().delete_comments(),
502
+ );
494
503
  trace!("Found match {:#?}", p_match);
495
504
  output.push(p_match.clone());
496
505
  }
@@ -25,8 +25,8 @@ 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, default_query,
29
- default_replace, default_replace_idx, default_replace_node, default_rule_name,
28
+ default_delete_comments, default_filters, default_groups, default_holes, default_is_seed_rule,
29
+ default_query, default_replace, default_replace_idx, default_replace_node, default_rule_name,
30
30
  },
31
31
  filter::Filter,
32
32
  Validator,
@@ -95,6 +95,13 @@ pub struct Rule {
95
95
  #[get = "pub"]
96
96
  #[pyo3(get)]
97
97
  is_seed_rule: bool,
98
+
99
+ /// Marks comments as deletable
100
+ #[builder(default = "default_delete_comments()")]
101
+ #[serde(default = "default_delete_comments")]
102
+ #[get = "pub"]
103
+ #[pyo3(get)]
104
+ delete_comments: bool,
98
105
  }
99
106
 
100
107
  impl Rule {
@@ -141,6 +148,7 @@ macro_rules! piranha_rule {
141
148
  $(, is_seed_rule = $is_seed_rule:expr)?
142
149
  $(, groups = [$($group_name: expr)*])?
143
150
  $(, filters = [$($filter:tt)*])?
151
+ $(, delete_comments = $delete_comments:expr)?
144
152
  ) => {
145
153
  $crate::models::rule::RuleBuilder::default()
146
154
  .name($name.to_string())
@@ -152,6 +160,7 @@ macro_rules! piranha_rule {
152
160
  $(.holes(std::collections::HashSet::from([$($hole.to_string(),)*])))?
153
161
  $(.groups(std::collections::HashSet::from([$($group_name.to_string(),)*])))?
154
162
  $(.filters(std::collections::HashSet::from([$($filter)*])))?
163
+ $(.delete_comments($delete_comments))?
155
164
  .build().unwrap()
156
165
  };
157
166
  }
@@ -162,7 +171,7 @@ impl Rule {
162
171
  fn py_new(
163
172
  name: String, query: Option<String>, replace: Option<String>, replace_idx: Option<u8>,
164
173
  replace_node: Option<String>, holes: Option<HashSet<String>>, groups: Option<HashSet<String>>,
165
- filters: Option<HashSet<Filter>>, is_seed_rule: Option<bool>,
174
+ filters: Option<HashSet<Filter>>, is_seed_rule: Option<bool>, delete_comments: Option<bool>,
166
175
  ) -> Self {
167
176
  let mut rule_builder = RuleBuilder::default();
168
177
 
@@ -199,6 +208,10 @@ impl Rule {
199
208
  rule_builder.is_seed_rule(is_seed_rule);
200
209
  }
201
210
 
211
+ if let Some(delete_comments) = delete_comments {
212
+ rule_builder.delete_comments(delete_comments);
213
+ }
214
+
202
215
  rule_builder.build().unwrap()
203
216
  }
204
217
 
@@ -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,66 @@ 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
+ delete_comments = false
397
+ };
398
+
399
+ let rule = InstantiatedRule::new(&_rule, &HashMap::new());
400
+ let source_code = "class Test {
401
+ public void foobar(){
402
+ // Given
403
+ variable.set_value(true);
404
+
405
+ // When
406
+ var result = data.Something();
407
+
408
+ // Then
409
+ assertTrue(\"This is a test\", result);
410
+ }
411
+ }";
412
+
413
+ let mut rule_store = RuleStore::default();
414
+
415
+ let args = PiranhaArgumentsBuilder::default()
416
+ .paths_to_codebase(vec![UNUSED_CODE_PATH.to_string()])
417
+ .language(PiranhaLanguage::from(JAVA))
418
+ .cleanup_comments(true)
419
+ .build();
420
+ let mut parser = args.language().parser();
421
+
422
+ let mut source_code_unit = SourceCodeUnit::new(
423
+ &mut parser,
424
+ source_code.to_string(),
425
+ &HashMap::new(),
426
+ PathBuf::new().as_path(),
427
+ &args,
428
+ );
429
+ let node = source_code_unit.root_node();
430
+ let matches = source_code_unit.get_matches(&rule, &mut rule_store, node, true);
431
+ assert!(!matches.is_empty());
432
+
433
+ let edit = source_code_unit.get_edit(&rule, &mut rule_store, node, true);
434
+ assert!(edit.is_some());
435
+ let edit = edit.unwrap();
436
+
437
+ // Apply the edit to the source code unit
438
+ source_code_unit.apply_edit(&edit, &mut parser);
439
+
440
+ // Inspect the resulting code
441
+ let edited_code = source_code_unit.code();
442
+
443
+ // Now assert on the full edited code
444
+ assert!(edited_code.contains("// Given"));
445
+ assert!(edited_code.contains("// When"));
446
+ assert!(edited_code.contains("// Then"));
447
+ assert!(!edited_code.contains("variable.set_value(true);"));
448
+ }