mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-04 11:16:53 +00:00
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
This commit is contained in:
parent
8e0d7bab60
commit
845a3d5bdf
2 changed files with 105 additions and 9 deletions
|
|
@ -64,6 +64,13 @@ def test_autofix_pretty_format_json(tmpdir):
|
|||
ret = pretty_format_json([srcfile.strpath])
|
||||
assert ret == 0
|
||||
|
||||
def test_orderfile_get_pretty_format():
|
||||
ret = pretty_format_json(['--top-keys=alist', get_resource_path('pretty_formatted_json.json')])
|
||||
assert ret == 0
|
||||
|
||||
def test_orderfile_get_pretty_format():
|
||||
ret = pretty_format_json(['--top-keys=blah', get_resource_path('pretty_formatted_json.json')])
|
||||
assert ret == 1
|
||||
|
||||
def test_badfile_pretty_format_json():
|
||||
ret = pretty_format_json([get_resource_path('ok_yaml.yaml')])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue