We can inspect class and instance methods to find these pattern: if class contains two methods like get_X and set_X we should raise UnpythonicGetterSetterViolation
We should also detect cases like:
x or _x or __xget_x or set_xIt is oop violation.
Because python does not need this abstraction:
@propertyHi, can I take the issue?
Sure! @Gwin73 thanks a lot!
Feel free to ask any questions.
@Gwin73 I have updated the task description. Please, take a look 馃檪
Hello, i am part of the same group as @Gwin73 who is working on this issue. Just to clarify some things, should it be:
x or _x or __xget_x or set_x?So when both cases are satisfied we should raise UnpythonicGetterSetterViolation or should we do so when either case is satisfied?
When either case is satisfied 馃檪 (logical or)
Thanks for the quick answer! So this would mean no instance or class level attributes are allowed since x matches anything?
I mean x is an abstract field name. It can be anything. Any name.
Wait I think there must be some misunderstanding here. Instance or class level attributes x or _x or __x must be allowed right, as long as they are "public" and have no corresponding get_x or set_x methods?
Only allowing properties and NO attributes seems a bit weird.
Sorry, that I am not able to express myself clear enough 馃檪
This rule only checks method names. We need to detect patterns like get_${existing_attribute_name} and set_${existing_attribute_name} and raise violations when any of these methods are found.
Where ${existing_attribute_name} can be public, protected, or private name of instance or class level attribute.
So it should be:
x or _x or __xget_x or set_xLogical AND
Yes 馃憤