-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix SS03 issues in docstrings #30733
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
Comments
I'll be working on this |
I think all those are false positives. The docstring being analyzed is not in pandas, but a the one of a Python object. This should be already fixed in the script, but not in the pandas version, but in the version moved to numpydoc. Which we still need to integrate into pandas. Feel free to have a look and double check. |
I've randomly sampled some examples and yes seems like those are all false positives. Is the revised script ready to use? If so, where can one find it? Or shall we wait until it is integrated into pandas? Thank you! |
I'm on it, just opened the PR, #30746, hopefully it merged in few days, and we can start using the new validation. In the meantime, feel free to fetch my branch locally, and run it, so get the new list of errors. |
I fetched your branch locally & tried running the new script but I get the same list of errors as previously. I'm not sure if I'm missing something, though. |
There were some changes implemented to the script, that were supposed to help get the docstring of the correct object. I'll have a look and find that PR, and see if everything is working as expected. I guess it's not. |
I was checking, I think this is the PR that was expected to fix this: #29012 Which was added to numpydoc: https://github.com/numpy/numpydoc/blob/master/numpydoc/validate.py#L130 So, my branch shouldn't report those errors. So, I guess the Do you want to have a look and see if you can find the problem and a fix for it? Thanks! |
Sure, I will take a look at it later! |
OK, so I just noticed that all of these false positives have
I'm guessing the errors returned here are too difficult to be introspected, so they are still reported but the source code file returns |
I think you're mixing two different things. That comment refers to knowing where is the docstring being written in the code (in which file, and in which line number). That in some cases it's impossible to know. Imagine something like: def foo():
pass
foo.__doc__ = open('/tmp/docstring').read() And there could be even trickier things, that won't let us know where to find the docstring. This is why we return For those false positives, we don't care about where the docstring is (we care in the json, to help contributors find where they need to make the changes). What we care is about the content of the docstring, and this should be always possible to obtain with: foo.__doc__ The only problem is that if |
I see, noted. I assumed there missing source file and the false positives are always related, but now I understand that they aren't. I checked again and some of the errors reported were indeed true positives (e.g. But there are some that I'm not sure whether they are false positives or not, e.g. all the errors that end with |
I think I answered via email, but the problem with I think the best would be to find a minimal example when instead of obtaining the right object, we validate something else. For example: class MyClass:
@property
def my_property(self):
"""We should validate this."""
return 'foo' # we are validating the docstring of the Python type str instead Then, add a unit test in numpydoc, and fix it. I think it's probably not easy, but I think it's doable. |
Closing this issue since I've fixed SS03 errors in #30939; will open a separate issue regarding the validation script |
Fix the docstrings where summary does not end with a period.
Current errors found:
The text was updated successfully, but these errors were encountered: