Code Monkey home page Code Monkey logo

Comments (8)

ndevenish avatar ndevenish commented on July 17, 2024 1

--pre-summary-space matches the --pre-summary-newline option for naming, so would probably be the least confusing.

from docformatter.

alecmerdler avatar alecmerdler commented on July 17, 2024

@ndevenish Made a pull request adding this option. Mind trying it out?

from docformatter.

merwok avatar merwok commented on July 17, 2024

😮 I have seen extra spaces around a one-line docstring, or extra leading space on the first line of a multiline docstring, but didn’t know there was a style of one-line docstring with leading space but no trailing space.

from docformatter.

thejcannon avatar thejcannon commented on July 17, 2024

Note that black inserts the leading whitespace. Therefore if you use both black and docformatter you'll be in formatting limbo.

See psf/black#2912

from docformatter.

thejcannon avatar thejcannon commented on July 17, 2024

Also worth pointing out https://docs.python.org/3/library/inspect.html#inspect.cleandoc strips this, so it should have no semantic difference (help docs do not have the whitespace).

from docformatter.

thejcannon avatar thejcannon commented on July 17, 2024

Last comment, black only inserts the leading space if the first character is the quote, so it's obvious there's an extra quote. Otherwise there isn't a leading space.

E.g.

# Adds leading space
""" "I'm quoted"."""
# But also doesn't
"""I'm not quoted."""

So applying the space everywhere would still land you in limbo.

from docformatter.

weibullguy avatar weibullguy commented on July 17, 2024

@thejcannon thanks for pointing this out.

PR #46 is submitted to add the leading space. Once that PR is merged, using the --pre-summary-space option will maintain the black-inserted space. For those who prefer the non-space formatting they would need to run black first, then docformatter. I've asked the #46 pull requester to address this interaction in the README.

from docformatter.

weibullguy avatar weibullguy commented on July 17, 2024

Closed by #46

from docformatter.

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.