Commit graph

15 commits

Author SHA1 Message Date
Calum Lind
5b6ddaf9f7 Fix pretty_format_json to use int indent
The indent parameter for json should be integer and under Python2 is
will raise an error if not. So switch from str to int and mention
default value in help text.
2017-12-10 22:33:33 +00:00
Calum Lind
00974efa31 Remove pretty_format_json simplejson dependency
* The simplejson module is only needed for <=py25 so replace with builtin json.
 * Replace six dependecy for simple Py2 check for convertion to unicode.
 * Cleanup quotes.
2017-12-10 22:33:33 +00:00
Anthony Sottile
e9aea74a77 Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -07:00
ushuz
10f8bd2f22 Add unit test for --no-ensure-ascii option 2017-03-20 20:19:01 +08:00
David Brown
e9e9c3d577 add test to show how it works a bit more 2016-11-03 18:05:43 -07:00
dmlb2000
84b1fb6827 let pre-commit fix some stuff 2016-11-03 15:54:48 -07:00
dmlb2000
7f057b0bd5 change the name to show both working and not instead of overwriting the function name 2016-11-03 15:51:24 -07:00
dmlb2000
845a3d5bdf adds top keys list of keys in hashes to put at the top of a hash
This adds custom sorting to preferencially add a list of top keys
at the start of any json hash in the json document
2016-11-03 09:41:23 -07:00
Anthony Sottile
cf3aabe9b1 Merge pull request #120 from sanmai-NL/JSON_arbitrary_indentation_separator
Refactor legacy `indent: int` -> `indent: str`
2016-06-12 10:25:59 -07:00
Sander Maijers
a5628863e8
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.
2016-06-12 19:19:07 +02:00
Anthony Sottile
a99475afa0 Simplify the tests 2016-05-27 14:09:50 -07:00
mattclegg
bd4e37c366 Add test for '--no-sort-keys' 2016-04-14 10:41:39 +01:00
Anthony Sottile
7376a29d69 Write to temp directories in such a way that files get cleaned up 2015-12-26 10:58:33 -08:00
Anthony Sottile
3a3a7a153a Run pre-commit during test 2015-12-25 09:42:17 -08:00
Léo Cavaillé
55bf22dc4a Add new hook pretty-format-json
This new hook allows to standardize one's JSON files (sorted key/4
spaces indent).
By default it just fails if any file is not complying with the standard,
but you can also pass the arg `--autofix` and the hook will
pretty-format the file itself.

Good in use combined with the `check-json` hook.
2015-06-11 00:08:03 -04:00