Skip to content

D401 behaves differently in flake8-docstrings and pydocstyle #47

@NMertsch

Description

@NMertsch

Since PyCQA/pydocstyle#546, properties are exempt from D401 ("First line should be in imperative mood").

This plugin doesn't seem to reflect this.

Code:

"""This is my module."""
from functools import cached_property


class MyClass:
    """This is my class."""

    @property
    def my_property(self) -> str:
        """This is my property."""
        return "property"

    @cached_property
    def my_cached_property(self) -> str:
        """This is my cached property."""
        return "cached_property"

Versions and output:

$ python -V
Python 3.7.16
$ pydocstyle --version
6.3.0
$ flake8 --version
5.0.4 (flake8-docstrings: 1.6.0, mccabe: 0.7.0, pycodestyle: 2.9.1, pyflakes: 2.5.0) CPython 3.7.16 on Windows
$ pydocstyle code.py
[no output]
$ flake8 code.py
code.py:10:1: D401 First line should be in imperative mood; try rephrasing
code.py:15:1: D401 First line should be in imperative mood; try rephrasing

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