Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 288d505

Browse files
feat: bug fixes and improvements for migration (#1235)
Closes #1259. ### Summary of Changes Some Improvements to the migrate command: - include documentation similarity to similarity between two functions - include function similarity and documentation similarity to similarity between two classes - add hash function to Function and FunctionDocumentation - handle duplicated annotations - mark annotations with same type and target as unsure and generate a comment where they differ - improved output for migration by not printing each line separately - fix detection of global function in StrictDiffer - fix weighted levenshtein distance: now higher level changes should have increased costs ### Testing Instructions run `test_base_differ.py` and `test_mapping.py` --------- Co-authored-by: Aclrian <Aclrian@users.noreply.github.com> Co-authored-by: Lars Reimann <mail@larsreimann.com>
1 parent 6c3bd43 commit 288d505

File tree

15 files changed

+706
-246
lines changed

15 files changed

+706
-246
lines changed
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
{
2+
"schemaVersion": 2,
3+
"boundaryAnnotations": {
4+
"library_api/library_api.media/Book/__init__/number_of_times_this_book_was_borrowed": {
5+
"target": "library_api/library_api.media/Book/__init__/number_of_times_this_book_was_borrowed",
6+
"authors": ["aclrian", "migration"],
7+
"reviewers": [],
8+
"comment": "",
9+
"reviewResult": "",
10+
"interval": {
11+
"isDiscrete": true,
12+
"lowerIntervalLimit": 0,
13+
"lowerLimitType": 0,
14+
"upperIntervalLimit": 0,
15+
"upperLimitType": 2
16+
}
17+
}
18+
},
19+
"calledAfterAnnotations": {},
20+
"completeAnnotations": {},
21+
"descriptionAnnotations": {
22+
"library_api/library_api.notificate/send_message_to_person/message": {
23+
"target": "library_api/library_api.notificate/send_message_to_person/message",
24+
"authors": ["aclrian", "migration"],
25+
"reviewers": [],
26+
"comment": "",
27+
"newDescription": "the message that should be sent to a person",
28+
"reviewResult": ""
29+
}
30+
},
31+
"enumAnnotations": {
32+
"library_api/library_api.media/Book/__init__/genre": {
33+
"target": "library_api/library_api.media/Book/__init__/genre",
34+
"authors": ["aclrian", "migration"],
35+
"reviewers": [],
36+
"comment": "",
37+
"reviewResult": "",
38+
"enumName": "Genre",
39+
"pairs": [
40+
{
41+
"stringValue": "fiction",
42+
"instanceName": "FICTION"
43+
},
44+
{
45+
"stringValue": "nonfiction",
46+
"instanceName": "NONFICTION"
47+
},
48+
{
49+
"stringValue": "poetry",
50+
"instanceName": "POETRY"
51+
},
52+
{
53+
"stringValue": "drama",
54+
"instanceName": "DRAMA"
55+
},
56+
{
57+
"stringValue": "high_demand",
58+
"instanceName": "HIGH_DEMAND"
59+
},
60+
{
61+
"stringValue": "low_demand",
62+
"instanceName": "LOW_DEMAND"
63+
},
64+
{
65+
"stringValue": "other",
66+
"instanceName": "OTHER"
67+
}
68+
]
69+
}
70+
},
71+
"expertAnnotations": {},
72+
"groupAnnotations": {},
73+
"moveAnnotations": {},
74+
"pureAnnotations": {},
75+
"renameAnnotations": {
76+
"library_api/library_api.media/Book/__init__/isbn": {
77+
"target": "library_api/library_api.media/Book/__init__/isbn",
78+
"authors": ["aclrian", "migration"],
79+
"reviewers": [],
80+
"comment": "",
81+
"newName": "ISBN",
82+
"reviewResult": ""
83+
},
84+
"library_api/library_api.library/Library/__init__/staff": {
85+
"target": "library_api/library_api.library/Library/__init__/staff",
86+
"authors": ["aclrian", "migration"],
87+
"reviewers": [],
88+
"comment": "",
89+
"newName": "personnel",
90+
"reviewResult": ""
91+
},
92+
"library_api/library_api.persons/Employee/__init__/wage": {
93+
"target": "library_api/library_api.persons/Employee/__init__/wage",
94+
"authors": ["aclrian", "migration"],
95+
"reviewers": [],
96+
"comment": "",
97+
"newName": "salary",
98+
"reviewResult": ""
99+
}
100+
},
101+
"removeAnnotations": {},
102+
"todoAnnotations": {
103+
"library_api/library_api.media/Book/__init__/release_date": {
104+
"target": "library_api/library_api.media/Book/__init__/release_date",
105+
"authors": ["aclrian", "migration"],
106+
"reviewers": [],
107+
"comment": "",
108+
"newTodo": "releasedate annotation",
109+
"reviewResult": ""
110+
},
111+
"library_api/library_api.media/Book/__init__/author": {
112+
"target": "library_api/library_api.media/Book/__init__/author",
113+
"authors": ["aclrian", "migration"],
114+
"reviewers": [],
115+
"comment": "",
116+
"newTodo": "__init__ author annotation",
117+
"reviewResult": ""
118+
},
119+
"library_api/library_api.media/Book/__init__/borrow_until": {
120+
"target": "library_api/library_api.media/Book/__init__/borrow_until",
121+
"authors": ["aclrian", "migration"],
122+
"reviewers": [],
123+
"comment": "",
124+
"newTodo": "__init__ author borrow_until",
125+
"reviewResult": ""
126+
},
127+
"library_api/library_api.library/Library/__init__/name": {
128+
"target": "library_api/library_api.library/Library/__init__/name",
129+
"authors": ["aclrian", "migration"],
130+
"reviewers": [],
131+
"comment": "",
132+
"newTodo": "__init__ author name",
133+
"reviewResult": ""
134+
},
135+
"library_api/library_api.persons/Employee/__init__/address": {
136+
"target": "library_api/library_api.persons/Employee/__init__/address",
137+
"authors": ["aclrian", "migration"],
138+
"reviewers": [],
139+
"comment": "",
140+
"newTodo": "library_api.persons.Employee.__init__.address",
141+
"reviewResult": ""
142+
},
143+
"library_api/library_api.persons/Employee/__init__/last_name": {
144+
"target": "library_api/library_api.persons/Employee/__init__/last_name",
145+
"authors": ["aclrian", "migration"],
146+
"reviewers": [],
147+
"comment": "",
148+
"newTodo": "library_api.persons.Employee.__init__.last_name",
149+
"reviewResult": ""
150+
},
151+
"library_api/library_api.persons/Employee/__init__/first_name": {
152+
"target": "library_api/library_api.persons/Employee/__init__/first_name",
153+
"authors": ["aclrian", "migration"],
154+
"reviewers": [],
155+
"comment": "",
156+
"newTodo": "library_api.persons.Employee.__init__.first_name",
157+
"reviewResult": ""
158+
}
159+
},
160+
"valueAnnotations": {}
161+
}
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
{
2+
"schemaVersion": 2,
3+
"boundaryAnnotations": {},
4+
"calledAfterAnnotations": {},
5+
"completeAnnotations": {},
6+
"descriptionAnnotations": {
7+
"library_api/library_api.media/Book": {
8+
"target": "library_api/library_api.media/Book",
9+
"authors": ["aclrian", "migration"],
10+
"reviewers": [],
11+
"comment": "",
12+
"newDescription": "This is a book class",
13+
"reviewResult": ""
14+
}
15+
},
16+
"enumAnnotations": {},
17+
"expertAnnotations": {},
18+
"groupAnnotations": {},
19+
"moveAnnotations": {
20+
"library_api/library_api.notificate/send_message_to_person": {
21+
"target": "library_api/library_api.notificate/send_message_to_person",
22+
"authors": ["aclrian", "migration"],
23+
"reviewers": [],
24+
"comment": "",
25+
"destination": "library_api.message",
26+
"reviewResult": ""
27+
}
28+
},
29+
"pureAnnotations": {},
30+
"renameAnnotations": {
31+
"library_api/library_api.library/Library/borrow/user": {
32+
"target": "library_api/library_api.library/Library/borrow/user",
33+
"authors": ["aclrian", "migration"],
34+
"reviewers": [],
35+
"comment": "The @Rename Annotation with the new name 'person' from the previous version was at 'library_api/library_api.library/Library/borrow/user' and the possible alternatives in the new version of the api are: library_api/library_api.library/Library/borrow/user, library_api/library_api.library/Library/borrow/media",
36+
"newName": "person",
37+
"reviewResult": "unsure"
38+
},
39+
"library_api/library_api.library/Library/borrow/media": {
40+
"target": "library_api/library_api.library/Library/borrow/media",
41+
"authors": ["aclrian", "migration"],
42+
"reviewers": [],
43+
"comment": "The @Rename Annotation with the new name 'person' from the previous version was at 'library_api/library_api.library/Library/borrow/user' and the possible alternatives in the new version of the api are: library_api/library_api.library/Library/borrow/user, library_api/library_api.library/Library/borrow/media",
44+
"newName": "person",
45+
"reviewResult": "unsure"
46+
},
47+
"library_api/library_api.library/Library/borrow": {
48+
"target": "library_api/library_api.library/Library/borrow",
49+
"authors": ["aclrian", "migration"],
50+
"reviewers": [],
51+
"comment": "",
52+
"newName": "borrow_a_book",
53+
"reviewResult": ""
54+
},
55+
"library_api/library_api.library/Library/return_media": {
56+
"target": "library_api/library_api.library/Library/return_media",
57+
"authors": ["aclrian", "migration"],
58+
"reviewers": [],
59+
"comment": "",
60+
"newName": "give_book_Back",
61+
"reviewResult": ""
62+
},
63+
"library_api/library_api.library/Library/return_media/user": {
64+
"target": "library_api/library_api.library/Library/return_media/user",
65+
"authors": ["aclrian", "migration"],
66+
"reviewers": [],
67+
"comment": "The @Rename Annotation with the new name 'person' from the previous version was at 'library_api/library_api.library/Library/return_book/user' and the possible alternatives in the new version of the api are: library_api/library_api.library/Library/return_media/user, library_api/library_api.library/Library/return_media/media",
68+
"newName": "person",
69+
"reviewResult": "unsure"
70+
},
71+
"library_api/library_api.library/Library/return_media/media": {
72+
"target": "library_api/library_api.library/Library/return_media/media",
73+
"authors": ["aclrian", "migration"],
74+
"reviewers": [],
75+
"comment": "The @Rename Annotation with the new name 'person' from the previous version was at 'library_api/library_api.library/Library/return_book/user' and the possible alternatives in the new version of the api are: library_api/library_api.library/Library/return_media/user, library_api/library_api.library/Library/return_media/media",
76+
"newName": "person",
77+
"reviewResult": "unsure"
78+
},
79+
"library_api/library_api.library/Library/__init__/borrowed_media": {
80+
"target": "library_api/library_api.library/Library/__init__/borrowed_media",
81+
"authors": ["aclrian", "migration"],
82+
"reviewers": [],
83+
"comment": "The @Rename Annotation with the new name 'members' from the previous version was at 'library_api/library_api.library/Library/__init__/users' and the possible alternatives in the new version of the api are: library_api/library_api.library/Library/__init__/borrowed_media, library_api/library_api.library/Library/__init__/users",
84+
"newName": "members",
85+
"reviewResult": "unsure"
86+
},
87+
"library_api/library_api.library/Library/__init__/users": {
88+
"target": "library_api/library_api.library/Library/__init__/users",
89+
"authors": ["aclrian", "migration"],
90+
"reviewers": [],
91+
"comment": "The @Rename Annotation with the new name 'members' from the previous version was at 'library_api/library_api.library/Library/__init__/users' and the possible alternatives in the new version of the api are: library_api/library_api.library/Library/__init__/borrowed_media, library_api/library_api.library/Library/__init__/users",
92+
"newName": "members",
93+
"reviewResult": "unsure"
94+
},
95+
"library_api/library_api.library/Library": {
96+
"target": "library_api/library_api.library/Library",
97+
"authors": ["aclrian", "migration"],
98+
"reviewers": [],
99+
"comment": "",
100+
"newName": "OurLibrary",
101+
"reviewResult": ""
102+
},
103+
"library_api/library_api.persons/Employee": {
104+
"target": "library_api/library_api.persons/Employee",
105+
"authors": ["aclrian", "migration"],
106+
"reviewers": [],
107+
"comment": "",
108+
"newName": "Worker",
109+
"reviewResult": ""
110+
}
111+
},
112+
"removeAnnotations": {
113+
"library_api/library_api.library/Library/add_new_media": {
114+
"target": "library_api/library_api.library/Library/add_new_media",
115+
"authors": ["aclrian", "migration"],
116+
"reviewers": [],
117+
"comment": "",
118+
"reviewResult": ""
119+
}
120+
},
121+
"todoAnnotations": {
122+
"library_api/library_api.media/Book/__init__/borrow_by": {
123+
"target": "library_api/library_api.media/Book/__init__/borrow_by",
124+
"authors": ["aclrian", "migration"],
125+
"reviewers": [],
126+
"comment": "",
127+
"newTodo": "__init__ author borrow_by",
128+
"reviewResult": ""
129+
},
130+
"library_api/library_api.library/Library/__init__/borrowed_media": {
131+
"target": "library_api/library_api.library/Library/__init__/borrowed_media",
132+
"authors": ["aclrian", "migration"],
133+
"reviewers": [],
134+
"comment": "",
135+
"newTodo": "library_api.library.Library.return_book.user",
136+
"reviewResult": ""
137+
},
138+
"library_api/library_api.library/Library/__init__/users": {
139+
"target": "library_api/library_api.library/Library/__init__/users",
140+
"authors": ["aclrian", "migration"],
141+
"reviewers": [],
142+
"comment": "",
143+
"newTodo": "library_api.library.Library.return_book.user",
144+
"reviewResult": ""
145+
},
146+
"library_api/library_api.library/Library/borrow/user": {
147+
"target": "library_api/library_api.library/Library/borrow/user",
148+
"authors": ["aclrian", "migration"],
149+
"reviewers": [],
150+
"comment": "",
151+
"newTodo": "library_api.library.Library.return_book.user",
152+
"reviewResult": ""
153+
},
154+
"library_api/library_api.library/Library/borrow/media": {
155+
"target": "library_api/library_api.library/Library/borrow/media",
156+
"authors": ["aclrian", "migration"],
157+
"reviewers": [],
158+
"comment": "",
159+
"newTodo": "library_api.library.Library.return_book.user",
160+
"reviewResult": ""
161+
},
162+
"library_api/library_api.library/Library/return_media/user": {
163+
"target": "library_api/library_api.library/Library/return_media/user",
164+
"authors": ["aclrian", "migration"],
165+
"reviewers": [],
166+
"comment": "",
167+
"newTodo": "library_api.library.Library.return_book.user",
168+
"reviewResult": ""
169+
},
170+
"library_api/library_api.library/Library/return_media/media": {
171+
"target": "library_api/library_api.library/Library/return_media/media",
172+
"authors": ["aclrian", "migration"],
173+
"reviewers": [],
174+
"comment": "",
175+
"newTodo": "library_api.library.Library.return_book.user",
176+
"reviewResult": ""
177+
}
178+
},
179+
"valueAnnotations": {}
180+
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
from ._are_semantic_equal import are_semantic_equal
21
from ._generate_annotations import generate_annotations

0 commit comments

Comments
 (0)