Skip to content
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

D401 does not properly check one-word documentations #421

Closed
Strus opened this issue Oct 18, 2019 · 0 comments
Closed

D401 does not properly check one-word documentations #421

Strus opened this issue Oct 18, 2019 · 0 comments

Comments

@Strus
Copy link
Contributor

@Strus Strus commented Oct 18, 2019

pydocstyle version: 4.0.1

D401 does not detect errors in documentation if it is just one word.

Example:

"""Test file."""

class Foo:
    """Represents something."""

    def __init__(self, bar):
        """Constructor.

        :param bar: bar
        """
        self.bar = bar
pydocstyle --ignore D203,D213,D407,D416 test.py
<empty output>

When I add some more words to __init__ documentation, it properly detects D401:

"""Test file."""

class Foo:
    """Represents something."""

    def __init__(self, bar):
        """Constructor of Foo.

        :param bar: bar
        """
        self.bar = bar
pydocstyle --ignore D203,D213,D407,D416 test.py
test.py:7 in public method `__init__`:
        D401: First line should be in imperative mood; try rephrasing (found 'Constructor')

It also does not detect other single words like for example Initalizer.

Strus added a commit to Strus/pydocstyle that referenced this issue Oct 18, 2019
Strus added a commit to Strus/pydocstyle that referenced this issue Oct 18, 2019
Strus added a commit to Strus/pydocstyle that referenced this issue Oct 18, 2019
Strus added a commit to Strus/pydocstyle that referenced this issue Nov 22, 2019
Nurdok added a commit that referenced this issue Nov 30, 2019
…ne word and ending with non-alpha character (#421) (#422)

* Fix D401 and D404 checks not working for docstrings containing only one word and ending with non-alpha character (#421)

* Add test and information in release notes. (#421)

* Fix too long test documentation. (#421)

* Move regex for stripping non-alphanumeric characters outside of strip_non_alphanumeric function. (#421)
@Strus Strus closed this Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.