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

2-space indentation docstrings are not formatted correctly #1488

Closed
fredrikaverpil opened this issue Jun 10, 2020 · 2 comments
Closed

2-space indentation docstrings are not formatted correctly #1488

fredrikaverpil opened this issue Jun 10, 2020 · 2 comments
Labels
T: bug Something isn't working

Comments

@fredrikaverpil
Copy link

fredrikaverpil commented Jun 10, 2020

I am formatting a 2-space indentation codebase and I'm using black. I've noticed that it does not succeed completely in formatting the docstrings into a 4-space indentation.

To Reproduce

Consider this file:

def foo():
  """Foo.

  Foo bar la la la...
  """
  pass

By just running "black" on it, this produces the following:

def foo():
    """Foo.

  Foo bar la la la...
  """
    pass

Expected behavior

The expected behavior would be to also fix the """ part at the end of the docstring.

Environment

  • Version: 19.10b0
  • OS and Python version: Windows 10, Python 3.7.4.

Does this bug also happen on master?

No. Using the online formatter, I get the expected behavior.

@fredrikaverpil fredrikaverpil added the T: bug Something isn't working label Jun 10, 2020
@ichard26
Copy link
Collaborator

ichard26 commented Jun 10, 2020

This has been fixed in master because of PR #1053.

Master (black, version 19.10b1.dev112+g3461338)

(black) richard-26@ubuntu-laptop:~/programming/black$ black test.py --diff --color
--- test.py	2020-06-10 19:32:34.305886 +0000
+++ test.py	2020-06-10 19:33:17.115094 +0000
@@ -1,6 +1,6 @@
 def foo():
-  """Foo.
+    """Foo.
 
-  Foo bar la la la...
-  """
-  pass
+    Foo bar la la la...
+    """
+    pass
would reformat test.py
All done! ✨ 🍰 ✨
1 file would be reformatted.

So it's just waiting on a release to happen :-)

@fredrikaverpil
Copy link
Author

fredrikaverpil commented Jun 10, 2020

This is excellent 😄 Then I will just install from master. 👍
Any idea when the next release may happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants