-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add newline after module docstrings (module_docstring_newlines
)
#7995
Comments
Cool, so this is part of Black's preview style? If so, we'll likely add it under our own (And thank you!) |
@konstin - Perhaps another good / easy one for preview. |
@charliermarsh Sorry should have been clearer. This is currently only available on |
I added a test case in #8044, it's not trivial to fix though |
We could try to format it as part of the module if the first statement in the suite is a doc comment without any leading comments? Not sure how to handle trailing suppression comments though. |
Change ```python """Test docstring""" a = 1 ``` to ```python """Test docstring""" a = 1 ``` in preview style, but don't touch the docstring otherwise. Do we want to ask black to also format the content of module level docstrings? Seems inconsistent to me that we change function and class docstring indentation/contents but not module docstrings. Fixes #7995
Change ```python """Test docstring""" a = 1 ``` to ```python """Test docstring""" a = 1 ``` in preview style, but don't touch the docstring otherwise. Do we want to ask black to also format the content of module level docstrings? Seems inconsistent to me that we change function and class docstring indentation/contents but not module docstrings. Fixes #7995
module_docstring_newlines
)
On the playground this does not currently get a newline added with the
format
option turned on.Recently a PR of mine got merged to
black
to include a newline after the module docstring:psf/black#3932
Most credits should go to others though for that PR as I mostly copied and rebased code.
It's still in the preview style but got generally favourable responses when initially proposed a couple of year ago. Since nobody has really objected to it during its previous iterations I expect it to be part of the default style some day.
Would
ruff
be open to to include this change toruff format
as well?EDIT: Oh, and congrats on the
0.1.0
release 🎉The text was updated successfully, but these errors were encountered: