google / google/yapf

YAPF fails to detect improper formatting under certain conditions

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

Description

Hello!

I stumbled upon a situation where YAPF fails to recognise that the following file needs reformatting:

**should-be-formatted.py:**

```python
foo(
bar = True , # comment
baz = False ,
)
```

**Steps to reproduce:**

```bash
yapf --style '{split_arguments_when_comma_terminated: true}' --diff ./should-be-formatted.py
```

**Expected output:**
A diff showing the proper formatting.

**Actual output:**
Nothing (no diff).

**Various ways to make it work:**

* Remove `# comment`, or
* Remove the line `baz = False ,`, or
* Do not specify `split_arguments_when_comma_terminated: true`.

**Environment:**
Docker: python:3.6.4-alpine3.7
YAPF: 0.20.1

Thanks!

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.