-
Notifications
You must be signed in to change notification settings - Fork 15
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 DOC203 #176
Comments
Hi, you'd need to annotate the return types in the function signature. def list_documented_parameters(docstring: str) -> tuple[list, list, list]: |
My code base actually does not have any annotations. I added one to the param arg to make the case simpler, but this error occurs with or without. There is |
If I may make a suggestion, the error code should be split into two:
This would allow me to ignore case (1), and give error messages that are precise. A further possibility to consider is to change the code so that DOC203 is not raised when |
pydoclint doesn't check "missing annotations" but rather inconsistent annotations. For example, if annotations are missing in the function signature and in the docstring, pydoclint is fine with that.
So in your example, return type annotation rather than argument type annotation missing. "arg type hints in signature" only covers the arg list, not the return type. |
I agree that this should be the behaviour.
Yes, it only refers to the arg list. Perhaps an additional flag is needed then. |
I am maintaining a code base that should work with old python versions, I cannot add annotations but would like to keep the informative docstring annotations. In my mind, unspecified annotations (that is, a lack of PEP 3107 annotations) are consistent and compatible with documented annotations. |
You can use the config option Also, if you are dealing with a legacy code base, you can also use the "baseline" feature: https://jsh9.github.io/pydoclint/config_options.html#17---baseline |
The following code I believe follows numpydoc style for the return documentation:
pydoclint gives:
"1: DOC203: Function
list_documented_parameters
return type(s) in docstring not consistent with the return annotation. Return annotation has 0 type(s); docstring return section has 3 type(s)."Sorry if I misunderstood something.
Version:
The text was updated successfully, but these errors were encountered: