-
-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADD] prohibited-method-override: Add a new check to identify methods marked as prohibited to override #485
Conversation
Thanks for the PR. I briefly went over your implementation and I have some questions. It seems like your current code looks for super() calls to attributes in the prohibited override methods variable. If that is the case, def my_method(self):
super().some_other_method() It seems to me that an overwrite would look more like this: def my_method(self):
super().my_method() I also don't have merging rights but I think this feature is too user specific, so maybe it makes sense to develop it as a separate plugin. |
Hey @antonag32, first and foremost, thanks for the quick reply! 😄 I've made a small change to fix the raised issue concerning attribute & parent method names not being equal. In regards to this check being too user specific, I understand that overwriting Odoo core methods is part of the development workflow. However, I would like to raise awareness among developers within my organization that there are some base methods considered to be sensitive, and extra care should be taken when modifying them. Nevertheless, this check won't raise any errors, only warnings, and it will remain optional. 🙂 |
hello @antonag32 @Pexers, I believe this is a very valid addition, we had some quality issues of engineers overriding base Odoo methods without the proper care of managing super calls. I feel this would be an awesome thing to had in the pylint-odoo. 👍🏻 +1 |
Please, review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although I can't imagine a use case for this 🤷🏼♂️
I guess the feature may be useful to some. However the user base that would benefit from it is probably relatively small so making sure the computations are not performed unless required is probably a good idea. As long as we follow that and keep the logic for this check simple (to avoid technical debt) I don't think it would be damaging to introduce this feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you squash commits and provide a meaningful commit description, please?
@Pexers the following was not addressed:
I think there should be only one commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're almost done!
Just a couple of suggestions regarding commit message:
- It includes PR number, but it shouldn't
- Title is too long (103 characters). Commit titles are usually stripped to 72 characters. I'd recommend summarizing, e.g.:
[ADD] prohibited-method-override: new check to avoid overriding methods
A new check that identifies methods that were marked as prohibited to override via super() calls. This lint check does not raise any errors, only warnings. Signed-off-by: Pexers <[email protected]>
All done ✅ Thank you for your time guys! 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Template
Description
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
test_175_prohibited_method_override
within test_main.py.Checklist: