-
Notifications
You must be signed in to change notification settings - Fork 16.4k
add magic method XCom docstrings D105 #37602
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
Conversation
|
Add XCom magic method docstrings #37523 |
potiuk
left a comment
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.
I find it odd that we need to describe the dunder methods (str ) - if that's the case then the rule should not be enabled.
It's simply wrong to describe what those methods do. Generally those descriptions, describe what is implemented in them (not what they do) - which is duplication and we should never try to attempt to describe in the docstring in plain English what is internal and plain visible in code - we should rather explain what is the intention of the methods (and we already know that because we know what the dunder methods in question do (__repr__, __eq_) . Repeating and explaining the algorithm used internally is really bad - because it's almost 100% certain that when we change the implementation (and for example add one more field in __repr__ ) we will forget to also update description and it will be just lying to us.
That makes value of those docstrings negative, because they will be misleading the user of those methods
|
I was striving for better readability by including detailed function descriptions but now I see how it can be misleading in the event of future changes. |
|
Magic methods already have defined semantics and documenting them is entirely missing the point. If a tool requires you to do it, it is not a good tool. |
Yep. Agree with @uranusjr - we shoudl NOT be documenting those ( |
|
My 2c, there is always depends on. E.g. why on earth we required to create
class Foo:
...
class Bar:
def __repr__(self):
return "BarSentinel"e.g. The problem here that for some methods you have to define, e.g. if you subclassing of I have not clear vision, should we define it for all classes (rule enable) or it should remain on conscience and responsibility of contributor/reviewers (rule disable). And there other question, do we have an idea why we originally (3 ago) select this rules #10742 . For example Personally I thought it is redundant to also enable |
|
As discussed in #38452 - we remove the D105 rule from our checks. |
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.