google / google/yapf

Kwarg & function call on same line as opening parenthesis, invalid per Google style

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

Description

The Google Python style guide (http://google.github.io/styleguide/pyguide.html#34-indentation) stipulates:

...there should be nothing after the open parenthesis or bracket on the first line.

YAPF version 0.29.0 reformats this conforming code to non-conforming code.

```python
- item_position = models.CharField(
- max_length=max([len(key) for key, value in POSITIONS]), choices=POSITIONS)
+ item_position = models.CharField(max_length=max(
+ [len(key) for key, value in POSITIONS]),
+ choices=POSITIONS)
```

It also reformats this conforming code to non-conforming code:

```python
- item_position = models.CharField(
- max_length=max([len(key) for key, value in POSITIONS]),
- choices=POSITIONS)
+ item_position = models.CharField(max_length=max(
+ [len(key) for key, value in POSITIONS]),
+ choices=POSITIONS)
```

yapf configuration from setup.cfg:
```ini
[yapf]
based_on_style = google
indent_width = 2
continuation_indent_width = 2
```

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.