google / google/yapf

Don't break after start of array literal

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

Description

This is what I have:
```
s = ['here', 'is', 'a', 'longish', 'array', 'literal']
```
and this is what I get with `yapf --no-local-style --style='{column_limit=40,split_all_top_level_comma_separated_values=True}'`
```
s = [
'here',
'is',
'a',
'longish',
'array',
'literal'
]
```

But what I'd like is
```
s = ['here',
'is',
'a',
'longish',
'array',
'literal']
```

The real issue is the break after the `[`, I can't figure out any way to remove this. I tried `split_before_expression_after_opening_paren=False`, I tried all kinds of stuff, penalties, etc., and no matter what I always get a break after the `[`.

Any suggestions?

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.