Skip to content

Validation check YD01 not implemented properly #365

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

Closed
martinlackner opened this issue Feb 1, 2022 · 1 comment · Fixed by #368
Closed

Validation check YD01 not implemented properly #365

martinlackner opened this issue Feb 1, 2022 · 1 comment · Fixed by #368

Comments

@martinlackner
Copy link

Hello!

The validation check YD01 is not implemented properly. The specific code in validate.py is the following:

if not doc.yields and "yield" in doc.method_source:

Since doc.method_source also contains the docstring, this condition is also satisfied if "yield" occurs in the docstring (where it might be used as a regular word).

I have encountered this bug in a function that did not contain a yield and it took me quite a while to figure out what was wrong.

@jnothman
Copy link
Member

Also fires a false alarm when there is a generator nested within the function, or when a variable name includes "yield". Rather we should be using inspect.isgeneratorfunction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants