-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestRefactoringRecognizer.test_extract_function.approved.txt
153 lines (140 loc) · 4.11 KB
/
TestRefactoringRecognizer.test_extract_function.approved.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# subprocess
stdout
- refactoring_name: Extract Method
new_name: fn
stderr
returncode
0
# Result
- refactoring_name: Extract Method
new_name: fn
# Result - Pretty
Extract Method: {'refactoring_name': 'Extract Method', 'new_name': 'fn'}
# __str__
# Diff output
--- diffs/lwh_pre_extract_function.py 2024-05-11 18:13:05
+++ diffs/lwh_original.py 2024-05-11 18:13:05
@@ -1,6 +1,10 @@
+def fn(d1, d2, d3):
+ value = d1 * d2 * d3
+ return value
+
def main():
l = 3
w = 4
h = 5
- vol = l * w * h
+ vol = fn(l, w, h)
print vol
# Task
# refactoring_task_description = """
# # Task: infer_refactoring
#
# Analyze the following output provided in 'unified diff' format
# Determine if any standard software code refactorings can be identified.
# If a refactoring is detected, provide output including
# - preferred refactoring name
# - attributes specific to this refactoring
#
# Assume that the user will understand common refactorings, so do not provide explanations for them.
#
# # Preferred refactoring name(s)
# Many similar names are commonly used for a refactoring.
# When you report a refactoring, use 'preferred name' below instead of one of the 'alternate names'.
#
# Further describe the refactoring by providing the attributes listed for each refactoring.
#
# For these attributes, provide both if they are different, otherwise suppress both.
# - original_class
# - new_class
#
# For these attributes, provide both if they are different, otherwise suppress both.
# - original_filename
# - new_filename
#
# Provide additional attributes if you think they are necessary.
#
# - preferred_name: Rename Variable
# alternate_names:
# - Rename Identifier
# attributes:
# - original_name
# - new_name
#
# - preferred_name: Rename Function
# alternate_names:
# - Rename Method
# attributes:
# - original_name
# - new_name
#
# - preferred_name: Extract Method
# alternate_names:
# - Extract Function
# - Extract Procedure
# attributes:
# - new_name
#
# - preferred_name: Move Method
# alternate_names:
# - Move Function
# - Move Procedure
#
# - preferred_name: Extract Class
# alternate_names:
# - Extract Module
#
# - preferred_name: Change Signature
# alternate_names:
# - Modify Function Signature
#
# - preferred_name: Replace Conditional with Polymorphism
# alternate_names:
# - Replace Conditional with Inheritance
#
# # Format
# Generate YAML output for refactoring actions.
# Output the YAML directly.
# - Do not preface the YAML with the string literal "yaml".
# - Do not display it in a text box.
# - Do not surround it with multi-line quotes.
# Ensure that string values are enclosed in double quotes only when necessary.
# Quotes are optional around values that contain only letters, numbers, and underscores.
# Avoid adding optional quotes.
# Do not add quotes around values that contain only letters, numbers, and underscores.
# Ensure that there are no optional blank lines between elements in the YAML output.
#
# In the following example, notice that these values are not surrounded by quotes
# - c
# - city
# - s
# - state
# - z
# - zip_code
#
#
# Also notice that there is not a blank line separating the items with new name: city, state, zip_code.
# These items are adjacent with no separation.
#
# Example:
# - refactoring_name: Rename Variable
# original_name: c
# new_name: city
# - refactoring_name: Rename Variable
# original_name: s
# new_name: state
# - refactoring_name: Rename Variable
# original_name: z
# new_name: zip_code
#
#
# For each refactoring, output these fields.
# - refactoring_name - Use the preferred name, not alternate names
# - [attributes] - See below for suggested attributes based on 'refactoring-name'.
# Do not output 'attributes' as a collection for attributes.
# Simply place the attributes at the same level as 'refactoring_name'.
# - [other] - if you feel that other information would be necessary to categorize the refactoring
#
# If you notice changes that are not refactorings, describe the changes in the output structure with key 'other changes'.
#
# Do NOT return YAML in a code block.