google / google/yapf

Line break of function/method declaration with args and keyword-args

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

Description

I don't know if this is an issue or a newer feature which I missed.

I have the following code:

```python
class Test(object):
def __init__(self, argument1, argument2, argument3, argument4=None, argument5=None, argument6=None):
pass
```
.. and would expect to get a result looking like this:

```python
class Test(object):
def __init__(self, argument1, argument2, argument3, argument4=None,
argument5=None, argument6=None):
pass
```
But instead ``yapf`` produces the following:

```python
class Test(object):
def __init__(self,
argument1,
argument2,
argument3,
argument4=None,
argument5=None,
argument6=None):
pass
```

This only happens when keyword-arguments are used.
Is there a way to turn off this behavior, or is it a bug?

This formatting is against our internal Python guidline.

I only had time to test this on a Windows machine with ``yapf 0.16.0``.

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.