google / google/yapf

Only reformat modified lines

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

Description

For an established project it is difficult to justify a humongous commit with all yapf's changes in one go, so adoption becomes difficult.

A lighter approach would be to instruct authors to use yapf to format only the lines they modified in the commit. This gets most of the advantages (no discussions on style, no need to point out all formatting mistakes), with an easy adoption path (and long term convergence).

Sadly, the only option to limit the scope I see is the range of lines. I assume it would be possible to make a git hook to reformat only changed lines based on that, but it looks very cumbersome. Is this kind of git integration planned, already existing and I missed it, or something you would consider adding?

Thanks!

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.