Apply black only on mdified files
Project description
apply black only on modifed lines.
POC, still a lot of work.
what
darken --since <git commitish>
Will (try to) reformat only modified lines since <commit-ish>
or
darken --range 12-34,64-67 foo.py
Should only reformat line 12-34 and 64-67 of foo.py.
how
Looking at black internal it seem relatively hard to pass a flag tell it to only refactor some nodes. But, black support fmt:on/off comments;
So this :
- insert comments;
- apply black
- remove the comments it added.
- TADA (TM)
Long term API design:
Get - some – integration with git; I'm thinking something along:
$ darken --since <commitish>
It would run git in the BG, figure out which files and which lines have changed and apply to black to relevant lines.
I'm thinking that if the changed lines represent a significant portion of the
file we could expand what need to be reformatted. Th metric for this need to be
determined. I prefer the $ darken --since
to a $ darken <a given commit only>
as it will correctly handle many things like merges, multipple-commits
branches...etc.
Issues:
This is an issue:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file darken-0.0.3.tar.gz
.
File metadata
- Download URL: darken-0.0.3.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.21.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43038413d05bb57cf6e3511f64817d500eb02dd3f59f8a36c681b6687da272dc |
|
MD5 | 14dec1f3f127450c51da7b8db7d70aec |
|
BLAKE2b-256 | eae59a103c7318d28199961ca437ed7de7c040441baebbc8a5420725d3f2cc4a |
File details
Details for the file darken-0.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: darken-0.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.21.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8fea6b14cee4f0325e908c7e6e527b1968e6ce425ad8c0872ae1a882bb3efd9 |
|
MD5 | 2d300cbe2ec4f0175e4ff4a4b58eee8b |
|
BLAKE2b-256 | bdab31b215384aa1266f5a6d174bdaef21e2881698c2d5c66e4080ef4f0c5709 |