You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Validation check YD01 not implemented properly #365
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.
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
Activity
jnothman commentedon Mar 13, 2022
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.isgeneratorfunctionUse isgeneratorfunction to avoid overgenerating YD01
Use isgeneratorfunction to avoid overgenerating YD01 (#368)