Skip to content

flake8-docstrings D100 issue while checking file passed to stdin #577

@XAMeLeOH

Description

@XAMeLeOH

Problem description

While using flake8 package to validate the code which uses pydocstyle or pep257 as backend and combination of flake8-docstrings and pycodestyle, docstrings don't validate correctly.

This is due to absent ability of backend (pydocstyle or pep257) work with content from stdin. Because of this pycodestyle provides helper function named stdin_get_value to avoid this problem.

But in case of using flake8 there are several plugins can read from stdin, so when it's stdin_get_value's turn there is no data in stdin.

Testing

To test the issue you have to install flake8 and flake8-docstrings packages, which will install dependent package including pycodestyle.

After the package will installed, create sample file (/tmp/testcase.py):

"""Module represent something."""


def main():
    print("Main")

if __name__ == "__main__":
    main()

While checking the file in regular way (flake8 /tmp/testcase.py) should be displayed lines below:

stdin:4:1: D103 Missing docstring in public function

The same file will give different result in case of passing it to stdin (flake8 - < /tmp/testcase.py):

stdin:1:1: D100 Missing docstring in public module

This is because pydocstyle gets an empty string as a source.

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