Refactor legacy `indent: int` -> `indent: str` · precommit/pre-commit-hooks@a562886 · GitHub
Skip to content

Commit a562886

Browse files
Sander MaijersSander Maijers
authored andcommitted
Refactor legacy indent: int -> indent: str
The type of `indent` parameter is preferably `str`. See http://simplejson.readthedocs.io/en/latest/index.html?highlight=dump#simplejson.dump . This change allows to specify TABs as indentation delimiter to `pretty_format_json`. Add input validator/converter for backward compat.
1 parent 6f2b0a2 commit a562886

3 files changed

Lines changed: 53 additions & 3 deletions

File tree

pre_commit_hooks/pretty_format_json.py

Lines changed: 22 additions & 3 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"alist": [
3+
2,
4+
34,
5+
234
6+
],
7+
"blah": null,
8+
"foo": "bar"
9+
}

tests/pretty_format_json_test.py

Lines changed: 22 additions & 0 deletions

0 commit comments

Comments
 (0)