-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Description
Describe the bug
We recently added --skip-magic-trailing-comma to black. When running with this option, we'd like it to always remove ugly unnecessary trailing commas that plagued some earlier versions of black, but it doesn't do this in the case of subscripts.
To Reproduce
(venv) ~/tmp/venv λ cat test.pyi
Tuple[A, B,]
def f(a, b,): ...
(venv) ~/tmp/venv λ black -l 130 test.pyi --skip-magic-trailing-comma --check --diff
--- test.pyi 2021-06-01 07:57:26.995533 +0000
+++ test.pyi 2021-06-01 07:58:31.094021 +0000
@@ -1,3 +1,3 @@
Tuple[A, B,]
-def f(a, b,): ...
+def f(a, b): ...
would reformat test.pyi
Oh no! 💥 💔 💥
1 file would be reformatted.
Expected behavior
If the subscript expression has more than one element, we should remove the extra trailing comma.
Reactions are currently unavailable