Replies: 5 comments 8 replies
-
I like the idea of removing docstring inheritance on sphinx. @keckler, @john-science is there a way to configure the linter to tell us how many and which methods don't have docstrings implemented? This might be a good thing to have as part of the code review checklist. |
Beta Was this translation helpful? Give feedback.
-
Well actually Pylint does check for methods without docstrings and is supposed to warn us. It should even warn in the case that a docstring is inherited, as long as the method itself does not have its own docstring defined. I didn't realize this before, but the issue (at least with the examples that I cited in my original post) is that we have enabled the So I guess the problem really only exists for short methods which have inherited docstrings. Not sure what the original reason was for implementing |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Okay, the problem is generally fixed in the docs except for subclasses of |
Beta Was this translation helpful? Give feedback.
-
There are multiple instances of methods that do not have docstrings, and in that case Sphinx will inherit the parent's docsting, if it exists. In some cases, this leads to misleading or inaccurate docstrings which are hard to identify unless one explicitly compares the documentation with the method source. Some particular examples of this are:
I understand that all those material classes are pretty niche, but those just happened to be some of the places that I noticed. The point is that this might be happening all over the codebase, and it is hard to immediately tell.
@john-science and I were discussing how this could be fixed. The most obvious solution is just to add docstrings for all the methods that are missing them. But another option that came up would be to disable to inheritance of docstrings from parent classes within Sphinx, as in something akin to: https://stackoverflow.com/questions/16518834/avoid-docstrings-from-parent-in-sphinx
The disabling of docstring inheritance would fix the described problem across the entire codebase with minimal effort. It would also have the added benefit of making it apparent when reading the documentation which methods are lacking docstrings entirely.
However, there could be undesirable consequences to disabling docstring inheritance, such as wiping out docstrings that indeed should be inherited. Or possibly leaving the codebase with many methods that have no descriptions at all, which could make the documentation possibly less useful.
Does anybody have any thoughts the possibility of disabling docstring inheritance within Sphinx?
@ntouran @jakehader @youngmit
Beta Was this translation helpful? Give feedback.
All reactions