google / google/yapf

DEDENT_CLOSING_BRACKETS doesn't always dedent

Open
#839 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

I've `DEDENT_CLOSING_BRACKETS = true`, and it most of the times, but not sometimes.

Here's a change that yapf applies:

```diff
@@ -942,13 +934,12 @@ class Order(BaseOrder):
paths[link_name] = target

for image in p.product.images.all():
- link_name = (
- '{product}/P-{order}/originals/{filename}'
- ).format(
- product=p.product_name,
- order=self.pk,
- filename=image.photo.original_filename,
- )
+ link_name = ('{product}/P-{order}/originals/{filename}'
+ ).format(
+ product=p.product_name,
+ order=self.pk,
+ filename=image.photo.original_filename,
+ )
target = image.photo.image
paths[link_name] = target

```

I think that becuase `).format` doesn't fit in this line, it moves it into the next (although the arguments and the closing bracket by themselves do fit), but doesn't respect dedenting.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.