google / google/yapf

Facebook style formatting confused by Python typings

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

The following function definition doesn't seem to be formatted correctly by the facebook style. Shortening or lengthening the line (e.g. changing `item_one_oh_one_two` to either `item_one` or `item_two_oh_one_three`) seems to fix the issue.

This is only using the `BASED_ON_STYLE = facebook` flag.

```
from typing import List

# Input:
def log_name_padding_out(item_one_oh_one_two: List[str], *, item_two: int = 15) -> None:
pass

# Expected:
def log_name_padding_out(
item_one_oh_one_two: List[str], *, item_two: int = 15
) -> None:
pass

# Actual:
def log_name_padding_out(item_one_oh_one_two: List[str], *,
item_two: int = 15) -> None:
pass
```

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.