-
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
Bring back the warnings when the docstring could not be parsed #196
Comments
Hi @Gabriel-p , it was probably a bug in pydoclint that was able to inform you that it couldn't parse the docstring. After I fixed that bug, this "ability" disappeared. What you are asking is quite valid and a good feature, but the difficult thing is: the definition of "could not parse" is vague. For example, you have a docstring written in the Google style, and you tried to use the numpy docstring parser to parse it, you won't end up with nothing. Instead, you often end up with a non-empty |
I guess the only way to address this that doesn't require some complicated method is to identify the minimum pattern expected for a given style and raise a warning if the docstring fails. For example, what does pydoclint do if a function contains input arguments and missing or no description and/or typehints for them? As far as I can tell it does nothing. Should this be a warning? Something like "you have undocumented arguments"? |
Hi @Gabriel-p , what you described is true. Because for example, if a docstring is written in the numpy style, and we ask the docstring parser to parse it in another style (such as Google), it won't be able to extract the arg list, the return section, etc. I think the task of detecting which style a docstring is written in falls a bit out of the scope of pydoclint. I think we need another linter to detect the style, and to throw a violation when the detected style is different from the intended style. There are two ways to potentially design this new linter:
|
It's not difficult to do No.2 above, and I can create a new project and publish it quite quickly. No.1 would require more work:
I'm not inclined to do No.1 simply because it's a bit time consuming. Also I'm not sure about how to name this new linter though. Note that the name "pydocstyle" is already taken. |
Hi @Gabriel-p , I've published a new version of pydoclint (0.6.0) to add this check. (I didn't end up creating another linter.) You can read more about this new feature here: https://jsh9.github.io/pydoclint/style_mismatch.html |
Upgraded to the latest version and unfortunately it doesn't address the issue. I have many functions that do not follow my specified format (sphinx) and pydoclint gives no warning:
All the modules that and in |
Hi @Gabriel-p , you need to manually turn this feature on: And I ended up with:
|
Oh I didn't realise that I had to turn the option on! It works great, thank you very much for the hard work @jsh9! |
This issue originated in #122 (comment) which led to this (now closed) issue #139, to which we circled back to in #169 (comment)
Before June 2024 pydoclint used to alert me when it couldn't parse a dostring using the selected style. This was very useful to me because it served as a remainder of functions that did not contain a valid (or any) docstring.
Then the package was updated and these warnings disappeared.
I do not need pydoclint to automatically recognize the style (as requested in #169), I'd just like those warnings back
The text was updated successfully, but these errors were encountered: