Commit Graph

39 Commits

Author SHA1 Message Date
Anthony Sottile a49f812a96 py39+
Committed via https://github.com/asottile/all-repos
2024-10-11 19:30:07 -04:00
Alex Marvin 25cdd5457b Continues processing JSONs even if hook fails (fixes #1038) 2024-04-20 13:15:14 -04:00
Anthony Sottile 8f6152921e drop python3.6 support
python 3.6 reached end of life on 2021-12-23

Committed via https://github.com/asottile/all-repos
2022-01-15 19:24:05 -05:00
Anthony Sottile 39ab2ed85e replace exit(main()) with raise SystemExit(main())
Committed via https://github.com/asottile/all-repos
2021-10-23 13:23:50 -04:00
jack1142 1de4fe6b42 Update `pretty-format-json` to write to stdout with utf-8 encoding 2021-03-15 17:48:24 -07:00
Anthony Sottile f5c42a050b pre-commit-hooks: python3.6+ 2020-02-05 11:22:18 -08:00
Anthony Sottile 86a010b750 Remove unnecessary double printing of filename 2019-10-12 13:48:13 -07:00
Joey Pinhas d6c0aa5a35 Remove useless newline 2019-09-24 16:27:34 -04:00
Joey Pinhas ea8fbf9cf0 Remove unneeded string join 2019-09-24 15:47:53 -04:00
Joey Pinhas ec6c39ee62 Print filenames in the diff 2019-09-24 15:42:24 -04:00
Joey Pinhas 31e740ed05 Use unified_diff 2019-09-15 13:48:00 -04:00
Joey Pinhas 27cd688c8e Flush stderr, and formatting 2019-09-15 13:29:52 -04:00
Joey Pinhas 831d2a99ab Print file line stderr 2019-09-15 12:51:03 -04:00
Joey Pinhas 93b7b66cda Remove erroneoous print statement 2019-09-13 14:38:40 -04:00
Joey Pinhas 0ff23d4e9f Remove extra cli flag, and update test case
This commit uses capsys to test the output of the diff, which is now
hidden behind the autofix flag if it's disabled
2019-09-13 14:30:52 -04:00
Joey Pinhas b28837a038 Add test case to test diffing function 2019-08-23 14:14:10 -04:00
Joey Pinhas 780f20249f Add option to show expected output
This prints a diff between the given json file and the expected
(pretty) output, with this functionality hidden behind a cli flag
2019-08-16 12:40:57 -04:00
Joey Pinhas 3e9db01775 Add logic to print line number of JSON errors
This commit makes the pretty JSON check more verbose when it encounters
errors, that way developers can see which lines are causing errors in
order to debug.
2019-08-15 12:32:33 -04:00
Anthony Sottile 4575652bd2 Use default flake8 config 2019-02-11 19:56:15 -08:00
Anthony Sottile 030bfac7e4 Apply typing to all of pre-commit-hooks 2019-01-31 20:09:15 -08:00
Anthony Sottile 63cc3414e9 Updates for flake8 3.7 2019-01-30 00:15:11 -08:00
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 2a902e0a07 Use asottile/add-trailing-comma 2017-07-12 18:58:30 -07:00
Anthony Sottile dc50b7f09c Attempt to fix the json hook under test 2017-03-20 11:25:45 -07:00
Anthony Sottile b95dcad616 Fixups 2017-03-20 08:24:58 -07:00
John Hu 543c5c7e1a Add an option to disable ensure_ascii 2017-03-20 20:19:01 +08:00
Anthony Sottile 9cee71b5df Add pyupgrade 2017-03-12 18:01:29 -07:00
dmlb2000 84b1fb6827 let pre-commit fix some stuff 2016-11-03 15:54:48 -07:00
dmlb2000 c7ab197645 don't need to blow away the space here 2016-11-03 15:49:04 -07:00
dmlb2000 d06a515ce1 this is much cleaner and might actually get all the coverage with out a bunch of work 2016-11-03 15:47:21 -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
Sander Maijers abaf0d12de
Fix exc. raising logic to match validation issues 2016-06-13 11:34:55 +02: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 17478a0a50 Style fixups 2016-04-14 08:25:52 -07:00
mattclegg f775891717 Drop messy py26 support in favour of 100% coverage 2016-04-14 11:16:18 +01:00
mattclegg 700b18ed0e Use OrderedDict to preserve order 2016-04-14 10:23:42 +01:00
Sébastien Larivière f769c208bc Addding no-sort-keys to pretty_format_json, this allows to disable the sort on the keys 2016-03-12 17:04:33 -05: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