Commit Graph

33 Commits

Author SHA1 Message Date
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
Max Rozentsveyg f35bfed79e Don't use LocalPath.strpath 2020-05-20 12:08:42 -04: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 ec6c39ee62 Print filenames in the diff 2019-09-24 15:42:24 -04:00
Joey Pinhas 7d878b55ff Fix test cases for unified_diff 2019-09-24 15:21:45 -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 35c76c4f33 Add test for std err 2019-09-15 12:54:03 -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
Anthony Sottile 8626e266dd double-quote-string-fixer 2019-02-11 19:57:37 -08: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
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