-
Notifications
You must be signed in to change notification settings - Fork 0
[DEV] Address Edge Case in MIM Refactorer #373
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingdevRelated to the Initial DevelopmentRelated to the Initial Development
Milestone
Description
The current MIM refactorer only checks for a matching method and immediately changes the instance calling it.
Need to change this so that:
- Checks the type of instance first to ensure that it is from appropriate class
- Considers subclasses
Consider the following situation:
class Test1:
...
def mim_method(self):
print("Hello World")
class Test2(Test1):
...
pass
class Test3:
...
def mim_method(self):
print("Bye World")
test1 = Test1()
test1.mim_method()
test2 = Test2()
test2.mim_method()
test3 = Test1()
test3.mim_method()
2 smells would be generated from this script the one for Test1 and Test3. Currently, when refactoring 1 of those smells say for Test1, all calls of mim_method() would be refactored which is wrong since Test3 is a completely separate class.
The wanted behaviour is therefore for the first 2 calls to mim_method() to be refactored and the last one ignored since it isn't of the same class as the identified smell nor a subclass.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdevRelated to the Initial DevelopmentRelated to the Initial Development
Type
Projects
Status
Done