Giter Site home page Giter Site logo

Comments (4)

keleshev avatar keleshev commented on July 4, 2024

the summary line may be on the same line as the opening quotes or on the next line

I can see that right now pep257 fails to follow this. However I don't agree with your implementation. The quote above sais summary line, which is applicable only to multi-line docstrings that are described as:

Multi-line docstrings consist of a summary line just like a one-line docstring, followed by a blank line, followed by a more elaborate description.

At the same time one-line docstrings:

They should really fit on one line.
def kos_root():
"""Return the pathname of the KOS root directory."""
global _kos_root
if _kos_root: return _kos_root
...

That means that the following docstrings are incorrect:

"""
Should end with a period.
"""

"""
Blank line missing after one-line summary.

"""

Since they "should really fit on one line".

But the following multi-line string is correct:

"""
Blank line missing after one-line summary.

More elaborate description...

"""

from pydocstyle.

artloder avatar artloder commented on July 4, 2024

I think the two expected-to-fail cases you provided are already covered by the check_one_liners check. When I run a pep257 against a file using either of those as method docstrings, I receive a One-liner docstrings should fit on one line with quotes message. Given that, any additional checks added would result in duplicate failures, so I think the current implementation is sufficient. Thoughts?

from pydocstyle.

keleshev avatar keleshev commented on July 4, 2024

Actually, yes, those checks take care of it.

from pydocstyle.

keleshev avatar keleshev commented on July 4, 2024

It seems weird though that PEP 257 actually allows this:

"""
Blank line missing after one-line summary.

More elaborate description...

"""

from pydocstyle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.