yapf PR or fork?
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
I was thinking about adding a couple of features for yapf - they are fairly specific to my personal coding style so I'd understand if they would be more appropriate in a fork rather than yapf itself. Let me know what you think.
1) I tend to apply alignment formatting to assignment statements in model-, class-, and __init__-level statements...
The code:
```
module_level_assignment = 10
class Foo(object):
class_level_assignment = 20
def __init__(self):
self._a = 30
self._b = 40
```
would become:
```
module_level_assignment = 10
class Foo(object):
class_level_assignment = 20
def __init__(self):
self._a = 30
self._b = 40
```
Internally, I'd refactor https://github.com/google/yapf/pull/649 and have that code and this code use similar logic. I'd probably also include functionality to specify the levels where alignment would be permitted (model-, class-, __init__-, any-level).
2) I add spaces around dict/list/tuple delimiters...
The code:
```
[1, 2, 3]
{'a': 'b'}
(x, y, z)
```
would become:
```
[ 1, 2, 3 ]
{ 'a' : 'b' }
( x, y, z ) # This one is tricky, as it will be interesting to differentiate between tuple delimiters and function calls, logical groupings, etc.
```
I'd put this functionality behind a switch that defaults to False (don't add spaces around delimiters).
What do you think - PR or fork?
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.