google / google/yapf

Support clang-format style lines argument

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

Description

yapf is based off of clang-format and takes some of the same flags, but its `lines` flag for some reason has a slightly different format than the clang-format `lines` flag:

```
-l START-END, --lines START-END
range of lines to reformat, one-based
```

vs

```
--lines= - : - format a range of
lines (both 1-based).
Multiple ranges can be formatted by specifying
several -lines arguments.
Can't be used with -offset and -length.
Can only be used with one input file.
```

Is there a technical reason for this? Obviously it's difficult to change at this point, but it would be nice to support the clang-format syntax as well. It's pretty clear what the user wants when they write `42:47` instead of `42-47` and using the syntax supported by the older and more established tool would make sense.

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.