[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 |
MichaReiser
left a comment
There was a problem hiding this comment.
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 :)
AlexWaygood
left a comment
There was a problem hiding this comment.
Overall this looks great to me -- thanks @augustelalande!
|
@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. |
AlexWaygood
left a comment
There was a problem hiding this comment.
Let's ship it. Thanks again!
Summary
Add
docstring-missing-yieldsamddocstring-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.