-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
F: docstringsHow we format docstringsHow we format docstringsR: outdatedResolved or not relevant anymore.Resolved or not relevant anymore.T: bugSomething isn't workingSomething isn't working
Description
Describe the bug
Black is overzealous about reformatting docstrings to a single line, and can cause the resulting line to be longer than the line length limit.
To Reproduce
For example, take this code:
def f():
"""89 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678
"""The first line of this docstring is exactly 88 characters. After blackening this code, this results in:
def f():
"""89 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678"""The line is now 91 characters, and flake8 complains.
Expected behavior
Honestly, I wouldn't expect black to reformat docstrings at all. But I definitely wouldn't expect it to reformat to the point where style-compliant code becomes non-style-compliant.
Environment
- Black's version: 22.10.0, main
- OS and Python version: macOS 12.6, Python 3.9.13
Additional context
This appears to be a regression of the same bug reported in #1632 and #2274.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
F: docstringsHow we format docstringsHow we format docstringsR: outdatedResolved or not relevant anymore.Resolved or not relevant anymore.T: bugSomething isn't workingSomething isn't working