Skip to content

Validation check YD01 not implemented properly #365

Closed

Description

@martinlackner

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.

Activity

  1. jnothman commented on Mar 13, 2022

    @jnothman
    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

  2. added a commit that references this issue on Mar 13, 2022
    52ac00a
  3. added a commit that references this issue on Mar 15, 2022
    9b7ada8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions