google / google/yapf

Hang closing brackets

Open
#605 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

Hey everyone,

Thanks for developing this tool! I'm trying to use in a project where the code style is to hang closing parenthesis. That's the E133 rule from `pep8`, that can be enabled with the `--hang-closing` option . For instance, we prefer:

```py
y = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
}
```

over

```py
y = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
}
```

I'm trying to set up `yapf` to enforce this, but it seems to always dedent the closing brackets... I thought setting `align_closing_bracket_with_visual_indent` to `true` was precisely made for this, but it doesn't seem to change anything...

Am I doing something wrong? Can I make `yapf` enforce hanging closing brackets? Thanks in advance!

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.