-
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
[pydoclint
] Add docstring-missing-yields
amd docstring-extraneous-yields
(DOC402
, DOC403
)
#12538
Conversation
What happened to the ecosystem check? Why isn't it making a comment of the changes? |
Not sure yet, it looks like the comment job can't find the artifact: https://github.com/astral-sh/ruff/actions/runs/10121063472/job/27991584964 |
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
DOC402 | 204 | 204 | 0 | 0 | 0 |
DOC403 | 1 | 1 | 0 | 0 | 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you and sorry for the wait. @AlexWaygood can you think of any other cases where a function would yield other than yield
and yield from
. If not, let's mege :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great to me -- thanks @augustelalande!
crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs
Outdated
Show resolved
Hide resolved
@augustelalande -- do you know exactly what the convention is with functions decorated with I can't immediately find anything about contextmanagers in the Sphinx or numpydoc docs, so I assume they're treated just like other functions with |
@AlexWaygood lol nice edge case. I'm not really sure, I couldn't find anything either. Trying to debate in my head, I'm pretty 50/50, both having and not having the violation make sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ship it. Thanks again!
Summary
Add
docstring-missing-yields
amddocstring-extraneous-yields
(DOC402
,DOC403
). These rules check that the yields defined (or not) in the docstring of a function match its implementation.The implementation is essentially a copy-paste of #12485
Part of #12434.
Test Plan
Test cases added.