-
Notifications
You must be signed in to change notification settings - Fork 17
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
False positive DOC201 #125
Comments
Interesting. This is an edge case that this option does not cover: https://jsh9.github.io/pydoclint/config_options.html#9---require-return-section-when-returning-nothing-shortform--rrs-default-false I think I'll add a patch to cover this case. |
Hi @ddelange , upon double checking, I found that this is by design rather than a bug. I actually even have a test case to cover this: pydoclint/tests/data/google/no_return_section/cases.py Lines 42 to 49 in 22b9b37
|
OK, let's leave it at that then 👍 |
I see that this is already closed, but was wondering if you could go into more detail about the rationale behind handling this edge case in this way. The way I am interpreting it, you are assuming that the function writer specifically chose to use "return" when it was not required. Therefore, they should have to add a section to the docstring because this is not a normal "return nothing" function. But in more complex functions, "return" might be used to escape a deeply nested set of conditionals, and is arguably required (at least without having to restructure the logic of the function). I would personally consider such a function a normal "return nothing" function that should not require a Returns section in the docstring. My two cents is a "Returns" docstring section should only be required if there is an empty "return" statement in the function that is not conditional (i.e. the last line of the function is "return"). The test you posted would still work as desired in that case and require a "Returns" section in the docstring, but the original example posted would not require it. |
Hi 👋
This function edits inplace and doesn't have a return value:
It throws a
DOC201: Function
smoothen_valuesdoes not have a return section in docstring
false positive.The text was updated successfully, but these errors were encountered: