yapf not breaking some long, breakable lines
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
We use yapf in Apache Beam's Python SDK, and occasionally I run into an issue where yapf will not break a breakable line that's longer than the column limit and I'm not sure why (as an aside, this is particularly frustrating in Beam where we also have pylint enforcing the column limit). [Here](https://github.com/apache/beam/pull/14940/commits/f0dbaf2aea002ea74e580103e72fd11b83395750) is an example of a commit I made manually that I would have expected yapf to apply automatically. A sample diff from that commit
```py
class Class(object):
to_pydatetime = frame_base.wont_implement_method(pd.core.indexes.accessors.DatetimeProperties,
'to_pydatetime', reason="non-deferred-result")
```
to:
```py
class Class(object):
to_pydatetime = frame_base.wont_implement_method(
pd.core.indexes.accessors.DatetimeProperties, 'to_pydatetime',
reason="non-deferred-result")
```
Our [config](https://github.com/apache/beam/blob/fdccad20f2af4f4af84b55529acae4b9d0004a01/sdks/python/setup.cfg#L58-L72):
```
[yapf]
indent_width = 2
continuation_indent_width = 4
column_limit = 80
allow_split_before_dict_value = False
blank_line_before_module_docstring = True
coalesce_brackets = True
each_dict_entry_on_separate_line = True
split_all_top_level_comma_separated_values = True
split_arguments_when_comma_terminated = True
split_before_expression_after_opening_paren = True
split_before_first_argument = True
split_before_logical_operator = False
# Use this feature to keep type ignore comments on the correct line
i18n_comment = # type: ignore.*
```
Is there something we could change in our config to make yapf apply this change? Or is this a bug or WAI?
Contributor guide
Assessment
This issue has not been assessed yet.