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

Formatter: Docstrings #6196

Closed
Tracked by #4798 ...
MichaReiser opened this issue Jul 31, 2023 · 0 comments · Fixed by #6452
Closed
Tracked by #4798 ...

Formatter: Docstrings #6196

MichaReiser opened this issue Jul 31, 2023 · 0 comments · Fixed by #6452
Assignees
Labels
formatter Related to the formatter

Comments

@MichaReiser
Copy link
Member

MichaReiser commented Jul 31, 2023

Black also processes docstrings. Firstly the indentation of docstrings is corrected for both quotations and the text within, although relative indentation in the text is preserved. Superfluous trailing whitespace on each line and unnecessary new lines at the end of the docstring are removed. All leading tabs are converted to spaces, but tabs inside text are preserved. Whitespace leading and trailing one-line docstrings is removed. [source]

@MichaReiser MichaReiser added this to the Formatter: Alpha milestone Jul 31, 2023
@MichaReiser MichaReiser added the formatter Related to the formatter label Jul 31, 2023
@charliermarsh charliermarsh self-assigned this Jul 31, 2023
@konstin konstin assigned konstin and unassigned charliermarsh Aug 3, 2023
konstin added a commit that referenced this issue Aug 14, 2023
**Summary** Implement docstring formatting

**Test Plan** Matches black's `docstring.py` fixture exactly, added some
new cases for what is hard to debug with black and with what black
doesn't cover.

similarity index:

main:
zulip: 0.99702
django: 0.99784
warehouse: 0.99585
build: 0.75623
transformers: 0.99469
cpython: 0.75989
typeshed: 0.74853

this branch:

zulip: 0.99702
django: 0.99784
warehouse: 0.99585
build: 0.75623
transformers: 0.99464
cpython: 0.75517
typeshed: 0.74853

The regression in transformers is actually an improvement in a file they
don't format with black (they run `black examples tests src utils
setup.py conftest.py`, the difference is in hubconf.py). cpython doesn't
use black.

Closes #6196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants