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

quotation mark at start or end of docstring #166

Open
jayvdb opened this Issue Dec 13, 2015 · 4 comments

Comments

Projects
3 participants
@jayvdb
Copy link
Member

jayvdb commented Dec 13, 2015

The new D403 (#165) triggers an error when an extra quotation mark is in the docstring, such as """"..."""

If the docstring has an extra quotation mark at the end ( """..."""") it will trigger D400, only if it is a one-line docstring.

The following does not generate a pep257 error:

def blah():
    """Foo.

    Extra line.
    """"

I think it would be useful to have a separate error code for either of those, as they are a specific case that is more of an error than a style issue, and there is less chance that the new code would be included in an ignore list.

I've found (and fixed) these quad-quotes in many projects that have large development teams and quality code review, even in cpython. And I am guilty of adding one. They slip through because they are hard to spot, by the coder and by reviewers; over-quotation-blindness or something.

fwiw, there is also a pep8 PR which will catch these, but again it is an indirect error rather than a specific check.

@Nurdok Nurdok modified the milestone: pydocstyle 1.1.0 Apr 23, 2016

@Nurdok Nurdok assigned Nurdok and unassigned Nurdok Oct 12, 2016

@varunagrawal

This comment has been minimized.

Copy link
Contributor

varunagrawal commented Oct 17, 2016

So something strange:

When I have a test file with the following content,

"""A file which is a module."""


def func():
    """"
    Yowza.

    This is a sample docstring
    """
    pass


def func1():
    """"Oh yeah."""

def func2():
    """Youch.""""
    pass

I get the following errors:

test.py:4 in public function `func`:
        D400: First line should end with a period (not '"')
test.py:4 in public function `func`:
        D205: 1 blank line required between summary line and description (found 0)

This is inconsistent with what @jayvdb mentioned above. Am I missing something?

@jayvdb

This comment has been minimized.

Copy link
Member

jayvdb commented Nov 3, 2016

@varunagrawal , your results are not inconsistent, but rather you have shown one way that is possible to trigger other rules to return errors.

Specifically, only line 4 in your example is returning errors, whereas the docstring for func1 and func2 are not returning errors.

@Nurdok

This comment has been minimized.

Copy link
Member

Nurdok commented Dec 3, 2016

@jayvdb @varunagrawal I don't really get how you can have an extra closing quote. It causes a syntax error:

$ python superfluous_quotes.py
  File "superfluous_quotes.py", line 22
    """Extra quote on the right.""""
                                   ^
SyntaxError: EOL while scanning string literal
@varunagrawal

This comment has been minimized.

Copy link
Contributor

varunagrawal commented Oct 10, 2017

Can we close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment