polyglot-piranha 0.3.26__tar.gz → 0.3.27__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 (161) hide show
  1. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/Cargo.lock +85 -46
  2. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/Cargo.toml +2 -1
  3. polyglot_piranha-0.3.27/PKG-INFO +124 -0
  4. polyglot_piranha-0.3.27/README.md +108 -0
  5. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/lib.rs +27 -9
  6. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/main.rs +8 -1
  7. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/concrete_syntax.rs +1 -1
  8. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/default_configs.rs +3 -3
  9. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/language.rs +3 -3
  10. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/matches.rs +51 -1
  11. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/piranha_arguments.rs +2 -2
  12. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/source_code_unit.rs +1 -1
  13. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/unit_tests/source_code_unit_test.rs +156 -1
  14. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/mod.rs +0 -1
  15. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_python.rs +7 -4
  16. polyglot_piranha-0.3.26/PKG-INFO +0 -57
  17. polyglot_piranha-0.3.26/README.md +0 -41
  18. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/EnumWithClassSymbol.java +0 -41
  19. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/PiranhaRuntimeException.java +0 -25
  20. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/PiranhaUtils.java +0 -151
  21. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/UsageCounter.java +0 -164
  22. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/XPFlagCleaner.java +0 -1607
  23. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/config/Config.java +0 -477
  24. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/config/MethodRecord.java +0 -121
  25. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/config/PiranhaConfigurationException.java +0 -12
  26. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/config/PiranhaEnumRecord.java +0 -79
  27. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/config/PiranhaMethodRecord.java +0 -107
  28. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/config/PiranhaRecord.java +0 -74
  29. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/testannotations/AnnotationArgument.java +0 -65
  30. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/testannotations/AnnotationResolutionException.java +0 -14
  31. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/testannotations/ResolvedTestAnnotation.java +0 -73
  32. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/testannotations/TestAnnotationResolver.java +0 -295
  33. polyglot_piranha-0.3.26/legacy/java/piranha/src/main/java/com/uber/piranha/testannotations/TestAnnotationSpecRecord.java +0 -152
  34. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/java/com/uber/piranha/ConfigurationTest.java +0 -1845
  35. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/java/com/uber/piranha/CorePiranhaTest.java +0 -1197
  36. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/java/com/uber/piranha/EnumConstantTest.java +0 -1256
  37. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/java/com/uber/piranha/PiranhaTestingHelpers.java +0 -60
  38. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/java/com/uber/piranha/TestCaseCleanUpTest.java +0 -836
  39. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/java/com/uber/piranha/TreatmentGroupsTest.java +0 -173
  40. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPFlagCleanerNegativeCases.java +0 -114
  41. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPFlagCleanerPositiveCases.java +0 -289
  42. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPFlagCleanerPositiveCasesControl.java +0 -193
  43. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPFlagCleanerPositiveCasesTreatment.java +0 -197
  44. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPMethodChainCases.java +0 -97
  45. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPMethodChainCasesControl.java +0 -73
  46. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPMethodChainCasesDoNotAllowMethodChain.java +0 -82
  47. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPMethodChainCasesDoNotallowArgMatchingAndMethodChain.java +0 -86
  48. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPMethodChainCasesTreatment.java +0 -73
  49. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPMethodChainCasesTreatmentDoNotAllowMatchingArgMethodInvc.java +0 -74
  50. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/XPTest.java +0 -68
  51. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/mock/BoolParam.java +0 -5
  52. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/mock/BoolParameter.java +0 -7
  53. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/mock/OverlappingNameInterface.java +0 -9
  54. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/mock/PVal.java +0 -9
  55. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/mock/Parameter.java +0 -8
  56. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/mock/SomeOtherInterface.java +0 -9
  57. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/mock/SomeParamRev.java +0 -9
  58. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/com/uber/piranha/mock/StaticMthds.java +0 -8
  59. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/invalid/piranha.properties +0 -6
  60. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/invalid/properties_test_invalid.json +0 -7
  61. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/invalid/properties_test_invalid_2.json +0 -13
  62. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/invalid/properties_test_invalid_3.json +0 -13
  63. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/invalid/properties_test_invalid_4.json +0 -13
  64. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_enum_no_arg.json +0 -16
  65. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_method_chain_control.json +0 -30
  66. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_method_chain_treated.json +0 -30
  67. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_no_flag_method_name.json +0 -29
  68. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_no_flag_method_name_no_method_chain.json +0 -29
  69. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_no_method_chain.json +0 -30
  70. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_argument.json +0 -34
  71. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_clean_by_setters_ignore_others.json +0 -60
  72. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_noFlag.json +0 -12
  73. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_noTreatmentGroup.json +0 -38
  74. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_receive.json +0 -29
  75. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_receive_argument.json +0 -76
  76. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_return.json +0 -38
  77. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_return_argument.json +0 -76
  78. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_return_receive.json +0 -76
  79. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_return_receive_argument.json +0 -172
  80. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_with_enum_no_match.json +0 -15
  81. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_with_enum_wrong_arg.json +0 -15
  82. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_test_without_enum.json +0 -9
  83. polyglot_piranha-0.3.26/legacy/java/piranha/src/test/resources/config/properties_unnecessary_instance_method.json +0 -74
  84. polyglot_piranha-0.3.26/legacy/java/sample/src/main/java/com/uber/mylib/MyClass.java +0 -50
  85. polyglot_piranha-0.3.26/legacy/java/sample/src/main/resources/com/uber/mylib/MyClass.bak +0 -50
  86. polyglot_piranha-0.3.26/legacy/java/sample/src/main/resources/com/uber/mylib/MyClass.expect +0 -46
  87. polyglot_piranha-0.3.26/legacy/javascript/src/config_checker.js +0 -69
  88. polyglot_piranha-0.3.26/legacy/javascript/src/piranha.js +0 -139
  89. polyglot_piranha-0.3.26/legacy/javascript/src/refactor.js +0 -727
  90. polyglot_piranha-0.3.26/legacy/javascript/src/source_checker.js +0 -41
  91. polyglot_piranha-0.3.26/legacy/objc/src/XPFlagRefactoring/CMakeLists.txt +0 -21
  92. polyglot_piranha-0.3.26/legacy/objc/src/XPFlagRefactoring/README.txt +0 -16
  93. polyglot_piranha-0.3.26/legacy/objc/src/XPFlagRefactoring/XPFlagRefactoring.cpp +0 -770
  94. polyglot_piranha-0.3.26/legacy/objc/src/XPFlagRefactoring/XPFlagRefactoring.exports +0 -0
  95. polyglot_piranha-0.3.26/site/src/components/AdditionalContent/index.js +0 -68
  96. polyglot_piranha-0.3.26/site/src/components/AdditionalContent/styles.module.css +0 -25
  97. polyglot_piranha-0.3.26/site/src/components/HomepageFeatures/index.js +0 -55
  98. polyglot_piranha-0.3.26/site/src/components/HomepageFeatures/styles.module.css +0 -11
  99. polyglot_piranha-0.3.26/site/src/css/custom.css +0 -29
  100. polyglot_piranha-0.3.26/site/src/pages/index.js +0 -48
  101. polyglot_piranha-0.3.26/site/src/pages/index.module.css +0 -23
  102. polyglot_piranha-0.3.26/src/tests/test_piranha_ruby.rs +0 -32
  103. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/LICENSE +0 -0
  104. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/plugins/pyproject.toml +0 -0
  105. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/pyproject.toml +0 -0
  106. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/go/edges.toml +0 -0
  107. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/go/rules.toml +0 -0
  108. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/go/scope_config.toml +0 -0
  109. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/java/edges.toml +0 -0
  110. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/java/rules.toml +0 -0
  111. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/java/scope_config.toml +0 -0
  112. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/java_cs/edges.toml +0 -0
  113. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/java_cs/rules.toml +0 -0
  114. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/java_cs/scope_config.toml +0 -0
  115. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/kt/edges.toml +0 -0
  116. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/kt/rules.toml +0 -0
  117. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/kt/scope_config.toml +0 -0
  118. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/ruby/edges.toml +0 -0
  119. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/ruby/rules.toml +0 -0
  120. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/ruby/scope_config.toml +0 -0
  121. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/scala/scope_config.toml +0 -0
  122. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/swift/edges.toml +0 -0
  123. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/swift/rules.toml +0 -0
  124. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/cleanup_rules/swift/scope_config.toml +0 -0
  125. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/df/README.md +0 -0
  126. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/df/analysis.rs +0 -0
  127. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/df/mod.rs +0 -0
  128. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/df/tag_analysis.rs +0 -0
  129. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/df/unit_tests/tag_analysis_test.rs +0 -0
  130. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/df/utils.rs +0 -0
  131. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/capture_group_patterns.rs +0 -0
  132. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/edit.rs +0 -0
  133. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/filter.rs +0 -0
  134. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/mod.rs +0 -0
  135. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/outgoing_edges.rs +0 -0
  136. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/piranha_output.rs +0 -0
  137. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/rule.rs +0 -0
  138. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/rule_graph.rs +0 -0
  139. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/rule_store.rs +0 -0
  140. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/scopes.rs +0 -0
  141. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/unit_tests/concrete_syntax_test.rs +0 -0
  142. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/unit_tests/piranha_arguments_test.rs +0 -0
  143. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/unit_tests/rule_graph_validation_test.rs +0 -0
  144. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/unit_tests/rule_test.rs +0 -0
  145. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/models/unit_tests/scopes_test.rs +0 -0
  146. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_go.rs +0 -0
  147. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_java.rs +0 -0
  148. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_kt.rs +0 -0
  149. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_scala.rs +0 -0
  150. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_scm.rs +0 -0
  151. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_strings.rs +0 -0
  152. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_swift.rs +0 -0
  153. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_thrift.rs +0 -0
  154. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_ts.rs +0 -0
  155. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_tsx.rs +0 -0
  156. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/tests/test_piranha_yaml.rs +0 -0
  157. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/utilities/mod.rs +0 -0
  158. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/utilities/regex_utilities.rs +0 -0
  159. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/utilities/tree_sitter_utilities.rs +0 -0
  160. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/utilities/unit_tests/tree_sitter_utilities_test.rs +0 -0
  161. {polyglot_piranha-0.3.26 → polyglot_piranha-0.3.27}/src/utilities/unit_tests/utilities_test.rs +0 -0
@@ -68,13 +68,14 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
68
68
 
69
69
  [[package]]
70
70
  name = "assert_cmd"
71
- version = "2.0.15"
71
+ version = "2.0.16"
72
72
  source = "registry+https://github.com/rust-lang/crates.io-index"
73
- checksum = "bc65048dd435533bb1baf2ed9956b9a278fbfdcf90301b39ee117f06c0199d37"
73
+ checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d"
74
74
  dependencies = [
75
75
  "anstyle",
76
76
  "bstr",
77
77
  "doc-comment",
78
+ "libc",
78
79
  "predicates",
79
80
  "predicates-core",
80
81
  "predicates-tree",
@@ -116,11 +117,17 @@ version = "1.0.0"
116
117
  source = "registry+https://github.com/rust-lang/crates.io-index"
117
118
  checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
118
119
 
120
+ [[package]]
121
+ name = "cfg_aliases"
122
+ version = "0.2.1"
123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
124
+ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
125
+
119
126
  [[package]]
120
127
  name = "clap"
121
- version = "4.5.11"
128
+ version = "4.5.16"
122
129
  source = "registry+https://github.com/rust-lang/crates.io-index"
123
- checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3"
130
+ checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019"
124
131
  dependencies = [
125
132
  "clap_builder",
126
133
  "clap_derive",
@@ -128,9 +135,9 @@ dependencies = [
128
135
 
129
136
  [[package]]
130
137
  name = "clap_builder"
131
- version = "4.5.11"
138
+ version = "4.5.15"
132
139
  source = "registry+https://github.com/rust-lang/crates.io-index"
133
- checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa"
140
+ checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6"
134
141
  dependencies = [
135
142
  "anstream",
136
143
  "anstyle",
@@ -140,14 +147,14 @@ dependencies = [
140
147
 
141
148
  [[package]]
142
149
  name = "clap_derive"
143
- version = "4.5.11"
150
+ version = "4.5.13"
144
151
  source = "registry+https://github.com/rust-lang/crates.io-index"
145
- checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e"
152
+ checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0"
146
153
  dependencies = [
147
154
  "heck 0.5.0",
148
155
  "proc-macro2",
149
156
  "quote",
150
- "syn 2.0.72",
157
+ "syn 2.0.77",
151
158
  ]
152
159
 
153
160
  [[package]]
@@ -228,6 +235,16 @@ version = "0.8.20"
228
235
  source = "registry+https://github.com/rust-lang/crates.io-index"
229
236
  checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
230
237
 
238
+ [[package]]
239
+ name = "ctrlc"
240
+ version = "3.4.5"
241
+ source = "registry+https://github.com/rust-lang/crates.io-index"
242
+ checksum = "90eeab0aa92f3f9b4e87f258c72b139c207d251f9cbc1080a0086b86a8870dd3"
243
+ dependencies = [
244
+ "nix",
245
+ "windows-sys 0.59.0",
246
+ ]
247
+
231
248
  [[package]]
232
249
  name = "darling"
233
250
  version = "0.14.4"
@@ -390,9 +407,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
390
407
 
391
408
  [[package]]
392
409
  name = "hermit-abi"
393
- version = "0.3.9"
410
+ version = "0.4.0"
394
411
  source = "registry+https://github.com/rust-lang/crates.io-index"
395
- checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
412
+ checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
396
413
 
397
414
  [[package]]
398
415
  name = "humantime"
@@ -408,9 +425,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
408
425
 
409
426
  [[package]]
410
427
  name = "indexmap"
411
- version = "2.2.6"
428
+ version = "2.5.0"
412
429
  source = "registry+https://github.com/rust-lang/crates.io-index"
413
- checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
430
+ checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
414
431
  dependencies = [
415
432
  "equivalent",
416
433
  "hashbrown",
@@ -424,9 +441,9 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
424
441
 
425
442
  [[package]]
426
443
  name = "is-terminal"
427
- version = "0.4.12"
444
+ version = "0.4.13"
428
445
  source = "registry+https://github.com/rust-lang/crates.io-index"
429
- checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b"
446
+ checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
430
447
  dependencies = [
431
448
  "hermit-abi",
432
449
  "libc",
@@ -478,9 +495,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
478
495
 
479
496
  [[package]]
480
497
  name = "libc"
481
- version = "0.2.155"
498
+ version = "0.2.158"
482
499
  source = "registry+https://github.com/rust-lang/crates.io-index"
483
- checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
500
+ checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
484
501
 
485
502
  [[package]]
486
503
  name = "lock_api"
@@ -513,6 +530,18 @@ dependencies = [
513
530
  "autocfg",
514
531
  ]
515
532
 
533
+ [[package]]
534
+ name = "nix"
535
+ version = "0.29.0"
536
+ source = "registry+https://github.com/rust-lang/crates.io-index"
537
+ checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
538
+ dependencies = [
539
+ "bitflags",
540
+ "cfg-if",
541
+ "cfg_aliases",
542
+ "libc",
543
+ ]
544
+
516
545
  [[package]]
517
546
  name = "normalize-line-endings"
518
547
  version = "0.3.0"
@@ -559,12 +588,13 @@ dependencies = [
559
588
 
560
589
  [[package]]
561
590
  name = "piranha"
562
- version = "0.3.26"
591
+ version = "0.3.27"
563
592
  dependencies = [
564
593
  "assert_cmd",
565
594
  "cc",
566
595
  "clap",
567
596
  "colored",
597
+ "ctrlc",
568
598
  "derive_builder",
569
599
  "env_logger",
570
600
  "getset",
@@ -726,7 +756,7 @@ dependencies = [
726
756
  "proc-macro2",
727
757
  "pyo3-macros-backend",
728
758
  "quote",
729
- "syn 2.0.72",
759
+ "syn 2.0.77",
730
760
  ]
731
761
 
732
762
  [[package]]
@@ -739,14 +769,14 @@ dependencies = [
739
769
  "proc-macro2",
740
770
  "pyo3-build-config",
741
771
  "quote",
742
- "syn 2.0.72",
772
+ "syn 2.0.77",
743
773
  ]
744
774
 
745
775
  [[package]]
746
776
  name = "quote"
747
- version = "1.0.36"
777
+ version = "1.0.37"
748
778
  source = "registry+https://github.com/rust-lang/crates.io-index"
749
- checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
779
+ checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
750
780
  dependencies = [
751
781
  "proc-macro2",
752
782
  ]
@@ -819,9 +849,9 @@ dependencies = [
819
849
 
820
850
  [[package]]
821
851
  name = "regex"
822
- version = "1.10.5"
852
+ version = "1.10.6"
823
853
  source = "registry+https://github.com/rust-lang/crates.io-index"
824
- checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
854
+ checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
825
855
  dependencies = [
826
856
  "aho-corasick",
827
857
  "memchr",
@@ -869,29 +899,29 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
869
899
 
870
900
  [[package]]
871
901
  name = "serde"
872
- version = "1.0.204"
902
+ version = "1.0.209"
873
903
  source = "registry+https://github.com/rust-lang/crates.io-index"
874
- checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
904
+ checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
875
905
  dependencies = [
876
906
  "serde_derive",
877
907
  ]
878
908
 
879
909
  [[package]]
880
910
  name = "serde_derive"
881
- version = "1.0.204"
911
+ version = "1.0.209"
882
912
  source = "registry+https://github.com/rust-lang/crates.io-index"
883
- checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
913
+ checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
884
914
  dependencies = [
885
915
  "proc-macro2",
886
916
  "quote",
887
- "syn 2.0.72",
917
+ "syn 2.0.77",
888
918
  ]
889
919
 
890
920
  [[package]]
891
921
  name = "serde_json"
892
- version = "1.0.121"
922
+ version = "1.0.127"
893
923
  source = "registry+https://github.com/rust-lang/crates.io-index"
894
- checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609"
924
+ checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
895
925
  dependencies = [
896
926
  "itoa",
897
927
  "memchr",
@@ -939,9 +969,9 @@ dependencies = [
939
969
 
940
970
  [[package]]
941
971
  name = "syn"
942
- version = "2.0.72"
972
+ version = "2.0.77"
943
973
  source = "registry+https://github.com/rust-lang/crates.io-index"
944
- checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
974
+ checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed"
945
975
  dependencies = [
946
976
  "proc-macro2",
947
977
  "quote",
@@ -950,9 +980,9 @@ dependencies = [
950
980
 
951
981
  [[package]]
952
982
  name = "target-lexicon"
953
- version = "0.12.15"
983
+ version = "0.12.16"
954
984
  source = "registry+https://github.com/rust-lang/crates.io-index"
955
- checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2"
985
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
956
986
 
957
987
  [[package]]
958
988
  name = "tempdir"
@@ -981,9 +1011,9 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76"
981
1011
 
982
1012
  [[package]]
983
1013
  name = "toml"
984
- version = "0.8.16"
1014
+ version = "0.8.19"
985
1015
  source = "registry+https://github.com/rust-lang/crates.io-index"
986
- checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c"
1016
+ checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
987
1017
  dependencies = [
988
1018
  "serde",
989
1019
  "serde_spanned",
@@ -993,18 +1023,18 @@ dependencies = [
993
1023
 
994
1024
  [[package]]
995
1025
  name = "toml_datetime"
996
- version = "0.6.7"
1026
+ version = "0.6.8"
997
1027
  source = "registry+https://github.com/rust-lang/crates.io-index"
998
- checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db"
1028
+ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
999
1029
  dependencies = [
1000
1030
  "serde",
1001
1031
  ]
1002
1032
 
1003
1033
  [[package]]
1004
1034
  name = "toml_edit"
1005
- version = "0.22.17"
1035
+ version = "0.22.20"
1006
1036
  source = "registry+https://github.com/rust-lang/crates.io-index"
1007
- checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16"
1037
+ checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d"
1008
1038
  dependencies = [
1009
1039
  "indexmap",
1010
1040
  "serde",
@@ -1200,11 +1230,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1200
1230
 
1201
1231
  [[package]]
1202
1232
  name = "winapi-util"
1203
- version = "0.1.8"
1233
+ version = "0.1.9"
1204
1234
  source = "registry+https://github.com/rust-lang/crates.io-index"
1205
- checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
1235
+ checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
1206
1236
  dependencies = [
1207
- "windows-sys 0.52.0",
1237
+ "windows-sys 0.59.0",
1208
1238
  ]
1209
1239
 
1210
1240
  [[package]]
@@ -1231,6 +1261,15 @@ dependencies = [
1231
1261
  "windows-targets 0.52.6",
1232
1262
  ]
1233
1263
 
1264
+ [[package]]
1265
+ name = "windows-sys"
1266
+ version = "0.59.0"
1267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1268
+ checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
1269
+ dependencies = [
1270
+ "windows-targets 0.52.6",
1271
+ ]
1272
+
1234
1273
  [[package]]
1235
1274
  name = "windows-targets"
1236
1275
  version = "0.48.5"
@@ -1354,9 +1393,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
1354
1393
 
1355
1394
  [[package]]
1356
1395
  name = "winnow"
1357
- version = "0.6.16"
1396
+ version = "0.6.18"
1358
1397
  source = "registry+https://github.com/rust-lang/crates.io-index"
1359
- checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c"
1398
+ checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f"
1360
1399
  dependencies = [
1361
1400
  "memchr",
1362
1401
  ]
@@ -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.26"
5
+ version = "0.3.27"
6
6
  edition = "2021"
7
7
  include = ["pyproject.toml", "src/"]
8
8
  exclude = ["legacy"]
@@ -44,6 +44,7 @@ log = "0.4.16"
44
44
  env_logger = "0.10.0"
45
45
  tempdir = "0.3"
46
46
  serde_json = "1.0.82"
47
+ ctrlc = "3.4"
47
48
 
48
49
  # TODO: Update if we upgrade tree-sitter to >=0.21
49
50
  tree-sitter-kotlin = "=0.3.5"
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.3
2
+ Name: polyglot_piranha
3
+ Version: 0.3.27
4
+ License-File: LICENSE
5
+ License-File: NOTICE
6
+ Summary: Polyglot Piranha is a library for performing structural find and replace with deep cleanup.
7
+ Keywords: refactoring,code update,structural find-replace,structural search and replace,structural search
8
+ Author: Uber Technologies Inc.
9
+ License: Apache-2.0
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
12
+ Project-URL: homepage, https://github.com/uber/piranha
13
+ Project-URL: documentation, https://github.com/uber/piranha
14
+ Project-URL: repository, https://github.com/uber/piranha
15
+
16
+ # PolyglotPiranha
17
+
18
+ PolyglotPiranha is a lightweight code transformation toolset for automating large scale changes. At Uber, it is mostly used to clean up stale feature flags.
19
+
20
+
21
+ ## Installation
22
+
23
+ To install Polyglot Piranha, you can use it as a Python library or as a command-line tool.
24
+
25
+ ### Python API
26
+
27
+ To install the Python API, run the following command:
28
+
29
+ ```bash
30
+ pip install polyglot-piranha
31
+ ```
32
+
33
+ ### Command-line Interface
34
+
35
+ To install the command-line interface, follow these steps:
36
+
37
+ 1. Install [Rust](https://www.rust-lang.org/tools/install)
38
+ 2. Clone the repository: `git clone https://github.com/uber/piranha.git`
39
+ 3. Navigate to the cloned directory: `cd piranha`
40
+ 4. Build the project: `cargo build --release` (or `cargo build --release --no-default-features` for macOS)
41
+ 5. The binary will be generated under `target/release`
42
+
43
+ ## Example Usage
44
+
45
+ ```python
46
+ from polyglot_piranha import execute_piranha, PiranhaArguments, Rule, RuleGraph, OutgoingEdges
47
+
48
+ # Original code snippet
49
+ code = """
50
+ if (obj.isLocEnabled() || x > 0) {
51
+ // do something
52
+ } else {
53
+ // do something else!
54
+ }
55
+ """
56
+
57
+ # Define the rule to replace the method call
58
+ r1 = Rule(
59
+ name="replace_method",
60
+ query="cs :[x].isLocEnabled()", # cs indicates we are using concrete syntax
61
+ replace_node="*",
62
+ replace="true",
63
+ is_seed_rule=True
64
+ )
65
+
66
+ # Define the edges for the rule graph.
67
+ # In this case, boolean_literal_cleanup is already defined for java [see src/cleanup_rules]
68
+ edge = OutgoingEdges("replace_method", to=["boolean_literal_cleanup"], scope="parent")
69
+
70
+ # Create Piranha arguments
71
+ piranha_arguments = PiranhaArguments(
72
+ code_snippet=code,
73
+ language="java",
74
+ rule_graph=RuleGraph(rules=[r1], edges=[edge])
75
+ )
76
+
77
+ # Execute Piranha and print the transformed code
78
+ piranha_summary = execute_piranha(piranha_arguments)
79
+ print(piranha_summary[0].content)
80
+ ```
81
+
82
+
83
+ ## Documentation
84
+
85
+ For more examples and explanations of the toolset, please check our demos and extended [POLYGLOT_README.md](POLYGLOT_README.md) file.
86
+
87
+
88
+ ## Feature Flags
89
+
90
+
91
+ Feature flags are commonly used to enable gradual rollout or experiment with new features. In a few cases, even after the purpose of the flag is accomplished, the code pertaining to the feature flag is not removed. We refer to such flags as stale flags. The presence of code pertaining to stale flags can have the following drawbacks:
92
+ - Unnecessary code clutter increases the overall complexity w.r.t maintenance resulting in reduced developer productivity
93
+ - The flags can interfere with other experimental flags (e.g., due to nesting under a flag that is always false)
94
+ - Presence of unused code in the source as well as the binary
95
+ - Stale flags can also cause bugs
96
+
97
+ PolyglotPiranha is a tool that can automatically refactor code related to stale flags. At a higher level, the input to the tool is the name of the flag and the expected behavior, after specifying a list of APIs related to flags in a properties file. Piranha will use these inputs to automatically refactor the code according to the expected behavior.
98
+
99
+ PolyglotPiranha (as of May 2022) is a common refactoring tool to support multiple languages and feature flag APIs.
100
+ For legacy language-specific implementations please check following [tag](https://github.com/uber/piranha/releases/tag/last-version-having-legacy-piranha).
101
+
102
+
103
+
104
+ A few additional links on Piranha:
105
+
106
+ - Research paper published at [PLDI 2024](https://dl.acm.org/doi/10.1145/3656429) on PolyglotPiranha.
107
+ - A technical [report](report.pdf) detailing our experiences with using Piranha at Uber.
108
+ - A [blogpost](https://eng.uber.com/piranha/) presenting more information on Piranha.
109
+ - 6 minute [video](https://www.youtube.com/watch?v=V5XirDs6LX8&feature=emb_logo) overview of Piranha.
110
+
111
+ ## Support
112
+
113
+ If you have any questions on how to use Piranha or find any bugs, please [open a GitHub issue](https://github.com/uber/piranha/issues).
114
+
115
+ ## Contributors
116
+
117
+ We'd love for you to contribute to Piranha! Please note that once
118
+ you create a pull request, you will be asked to sign our [Uber Contributor License Agreement](https://cla-assistant.io/uber/piranha).
119
+
120
+ We are also looking for contributions to extend Piranha to other languages (C++, C#, Kotlin).
121
+
122
+ ## License
123
+ Piranha is licensed under the Apache 2.0 license. See the LICENSE file for more information.
124
+
@@ -0,0 +1,108 @@
1
+ # PolyglotPiranha
2
+
3
+ PolyglotPiranha is a lightweight code transformation toolset for automating large scale changes. At Uber, it is mostly used to clean up stale feature flags.
4
+
5
+
6
+ ## Installation
7
+
8
+ To install Polyglot Piranha, you can use it as a Python library or as a command-line tool.
9
+
10
+ ### Python API
11
+
12
+ To install the Python API, run the following command:
13
+
14
+ ```bash
15
+ pip install polyglot-piranha
16
+ ```
17
+
18
+ ### Command-line Interface
19
+
20
+ To install the command-line interface, follow these steps:
21
+
22
+ 1. Install [Rust](https://www.rust-lang.org/tools/install)
23
+ 2. Clone the repository: `git clone https://github.com/uber/piranha.git`
24
+ 3. Navigate to the cloned directory: `cd piranha`
25
+ 4. Build the project: `cargo build --release` (or `cargo build --release --no-default-features` for macOS)
26
+ 5. The binary will be generated under `target/release`
27
+
28
+ ## Example Usage
29
+
30
+ ```python
31
+ from polyglot_piranha import execute_piranha, PiranhaArguments, Rule, RuleGraph, OutgoingEdges
32
+
33
+ # Original code snippet
34
+ code = """
35
+ if (obj.isLocEnabled() || x > 0) {
36
+ // do something
37
+ } else {
38
+ // do something else!
39
+ }
40
+ """
41
+
42
+ # Define the rule to replace the method call
43
+ r1 = Rule(
44
+ name="replace_method",
45
+ query="cs :[x].isLocEnabled()", # cs indicates we are using concrete syntax
46
+ replace_node="*",
47
+ replace="true",
48
+ is_seed_rule=True
49
+ )
50
+
51
+ # Define the edges for the rule graph.
52
+ # In this case, boolean_literal_cleanup is already defined for java [see src/cleanup_rules]
53
+ edge = OutgoingEdges("replace_method", to=["boolean_literal_cleanup"], scope="parent")
54
+
55
+ # Create Piranha arguments
56
+ piranha_arguments = PiranhaArguments(
57
+ code_snippet=code,
58
+ language="java",
59
+ rule_graph=RuleGraph(rules=[r1], edges=[edge])
60
+ )
61
+
62
+ # Execute Piranha and print the transformed code
63
+ piranha_summary = execute_piranha(piranha_arguments)
64
+ print(piranha_summary[0].content)
65
+ ```
66
+
67
+
68
+ ## Documentation
69
+
70
+ For more examples and explanations of the toolset, please check our demos and extended [POLYGLOT_README.md](POLYGLOT_README.md) file.
71
+
72
+
73
+ ## Feature Flags
74
+
75
+
76
+ Feature flags are commonly used to enable gradual rollout or experiment with new features. In a few cases, even after the purpose of the flag is accomplished, the code pertaining to the feature flag is not removed. We refer to such flags as stale flags. The presence of code pertaining to stale flags can have the following drawbacks:
77
+ - Unnecessary code clutter increases the overall complexity w.r.t maintenance resulting in reduced developer productivity
78
+ - The flags can interfere with other experimental flags (e.g., due to nesting under a flag that is always false)
79
+ - Presence of unused code in the source as well as the binary
80
+ - Stale flags can also cause bugs
81
+
82
+ PolyglotPiranha is a tool that can automatically refactor code related to stale flags. At a higher level, the input to the tool is the name of the flag and the expected behavior, after specifying a list of APIs related to flags in a properties file. Piranha will use these inputs to automatically refactor the code according to the expected behavior.
83
+
84
+ PolyglotPiranha (as of May 2022) is a common refactoring tool to support multiple languages and feature flag APIs.
85
+ For legacy language-specific implementations please check following [tag](https://github.com/uber/piranha/releases/tag/last-version-having-legacy-piranha).
86
+
87
+
88
+
89
+ A few additional links on Piranha:
90
+
91
+ - Research paper published at [PLDI 2024](https://dl.acm.org/doi/10.1145/3656429) on PolyglotPiranha.
92
+ - A technical [report](report.pdf) detailing our experiences with using Piranha at Uber.
93
+ - A [blogpost](https://eng.uber.com/piranha/) presenting more information on Piranha.
94
+ - 6 minute [video](https://www.youtube.com/watch?v=V5XirDs6LX8&feature=emb_logo) overview of Piranha.
95
+
96
+ ## Support
97
+
98
+ If you have any questions on how to use Piranha or find any bugs, please [open a GitHub issue](https://github.com/uber/piranha/issues).
99
+
100
+ ## Contributors
101
+
102
+ We'd love for you to contribute to Piranha! Please note that once
103
+ you create a pull request, you will be asked to sign our [Uber Contributor License Agreement](https://cla-assistant.io/uber/piranha).
104
+
105
+ We are also looking for contributions to extend Piranha to other languages (C++, C#, Kotlin).
106
+
107
+ ## License
108
+ Piranha is licensed under the Apache 2.0 license. See the LICENSE file for more information.
@@ -60,8 +60,6 @@ fn polyglot_piranha(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
60
60
  /// For each file, it reports its content after the rewrite, the list of matches and the list of rewrites.
61
61
  #[pyfunction]
62
62
  pub fn execute_piranha(piranha_arguments: &PiranhaArguments) -> Vec<PiranhaOutputSummary> {
63
- info!("Executing Polyglot Piranha !!!");
64
-
65
63
  let mut piranha = Piranha::new(piranha_arguments);
66
64
  piranha.perform_cleanup();
67
65
 
@@ -80,15 +78,35 @@ fn log_piranha_output_summaries(summaries: &Vec<PiranhaOutputSummary>) {
80
78
  for summary in summaries {
81
79
  let number_of_rewrites = &summary.rewrites().len();
82
80
  let number_of_matches = &summary.matches().len();
83
- info!("File : {:?}", &summary.path());
84
- info!(" # Rewrites : {}", number_of_rewrites);
85
- info!(" # Matches : {}", number_of_matches);
81
+ info!(
82
+ "File: {:?} with {} matches and {} rewrites",
83
+ &summary.path(),
84
+ number_of_matches,
85
+ number_of_rewrites
86
+ );
87
+ if *number_of_rewrites > 0 {
88
+ let used_rules: Vec<&String> = summary
89
+ .rewrites()
90
+ .iter()
91
+ .map(|r| r.matched_rule())
92
+ .collect();
93
+ let deduplicated_rules: Vec<&String> = used_rules.into_iter().unique().collect();
94
+ info!(
95
+ "Rewrites used the following rules: {}",
96
+ deduplicated_rules.into_iter().join(", ")
97
+ );
98
+ }
86
99
  total_number_of_rewrites += number_of_rewrites;
87
100
  total_number_of_matches += number_of_matches;
88
101
  }
89
- info!("Total files affected/matched {}", &summaries.len());
90
- info!("Total number of matches {}", total_number_of_matches);
91
- info!("Total number of rewrites {}", total_number_of_rewrites);
102
+ if summaries.len() > 1 {
103
+ info!(
104
+ "Total files: {} (with {} matches and {} rewrites)",
105
+ &summaries.len(),
106
+ total_number_of_matches,
107
+ total_number_of_rewrites
108
+ );
109
+ }
92
110
  }
93
111
 
94
112
  // Maintains the state of Piranha and the updated content of files in the source code.
@@ -197,7 +215,7 @@ impl Piranha {
197
215
 
198
216
  /// Write the input code snippet into a temp directory.
199
217
  /// Returns: A temporary directory containing the created input code snippet as a file
200
- /// This function panics if it finds that neither `code_snippet` nor `path_to_configuration` are provided
218
+ /// This function panics if it finds that neither `code_snippet` nor `path_to_configuration` are provided
201
219
  fn write_code_snippet_to_temp(&self) -> TempDir {
202
220
  let temp_dir = TempDir::new_in(".", "tmp").unwrap();
203
221
  let temp_dir_path = temp_dir.path();
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  //! Defines the entry-point for Piranha.
15
- use std::{fs, time::Instant};
15
+ use std::{fs, process, time::Instant};
16
16
 
17
17
  use log::{debug, info};
18
18
  use polyglot_piranha::{
@@ -21,6 +21,13 @@ use polyglot_piranha::{
21
21
  };
22
22
 
23
23
  fn main() {
24
+ // Set up the Ctrl+C handler
25
+ ctrlc::set_handler(move || {
26
+ println!("Received Ctrl+C! Exiting...");
27
+ process::exit(130);
28
+ })
29
+ .expect("Error setting Ctrl+C handler");
30
+
24
31
  let now = Instant::now();
25
32
  env_logger::init();
26
33
 
@@ -65,13 +65,13 @@ pub(crate) fn get_all_matches_for_concrete_syntax(
65
65
  };
66
66
 
67
67
  match_map.insert(replace_node_key, replace_node_match.clone());
68
-
69
68
  matches.push(Match {
70
69
  matched_string: replace_node_match.text,
71
70
  range: replace_node_match.range,
72
71
  matches: match_map.into_iter().map(|(k, v)| (k, v.text)).collect(),
73
72
  associated_comma: None,
74
73
  associated_comments: Vec::new(),
74
+ associated_leading_empty_lines: Vec::new(),
75
75
  });
76
76
  }
77
77
  if recursive {