-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
DOC501 False Positive #12647
Comments
Just saw ruff==0.5.6 released. Double checked and it is still an issue in that version. |
Thank you! |
I think the issue is that the above section is actually ambiguous. All the defined sections are valid section names in both NumPy and Google. You should set the convention explicitly in your [tool.ruff.lint.pydocstyle]
convention = "google" (Adding |
You're correct, adding |
It might make sense to produce a more reasonable error message instead of a vague DOC501 linting error? |
@JasonGrace2282 - can you expand on that? It’s inferring a NumPy docstring, and in that case, it can’t find any raises. @will-schneble - gonna leave this open because I think we can improve our detection. |
I'm not familiar with how the parsing works in Ruff, but as a user I would expect a warning if the convention is numpy but a docstring looks like Google convention. |
this is confusing, doc use google style but it requires extra config https://docs.astral.sh/ruff/rules/docstring-missing-exception/ |
Describe the bug
DOC501 rule violation when the docstring includes the exception.
ruff==0.5.5
python==3.12.4
Command:
ruff check --preview --select DOC
No pyproject.toml or other configuration than what's shown here.
Steps to reproduce
Sample file to test against.
Expected behavior
No violations.
Running
pydoclint --style=google test.py
gives the expected no violation result.Debug logs
Notes
Adding an argument to Foo.get_bar and adding that to the docstring then makes the DOC501 violation go away. Example below:
The text was updated successfully, but these errors were encountered: