mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 20:16:53 +00:00
Fixups
This commit is contained in:
parent
4c3cc8f3ed
commit
b95dcad616
2 changed files with 5 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
sha: v0.7.0
|
sha: 4c3cc8f3edc3c673b3a4abe2054e64f21d26772c
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ def _get_pretty_format(contents, indent, ensure_ascii=True, sort_keys=True, top_
|
||||||
object_pairs_hook=pairs_first,
|
object_pairs_hook=pairs_first,
|
||||||
),
|
),
|
||||||
indent=indent,
|
indent=indent,
|
||||||
ensure_ascii=ensure_ascii
|
ensure_ascii=ensure_ascii,
|
||||||
)) + "\n" # dumps don't end with a newline
|
)) + "\n" # dumps does not end with a newline
|
||||||
|
|
||||||
|
|
||||||
def _autofix(filename, new_contents, encoding=None):
|
def _autofix(filename, new_contents, encoding=None):
|
||||||
|
|
@ -106,7 +106,7 @@ def pretty_format_json(argv=None):
|
||||||
try:
|
try:
|
||||||
pretty_contents = _get_pretty_format(
|
pretty_contents = _get_pretty_format(
|
||||||
contents, args.indent, ensure_ascii=not args.no_ensure_ascii,
|
contents, args.indent, ensure_ascii=not args.no_ensure_ascii,
|
||||||
sort_keys=not args.no_sort_keys, top_keys=args.top_keys
|
sort_keys=not args.no_sort_keys, top_keys=args.top_keys,
|
||||||
)
|
)
|
||||||
|
|
||||||
if contents != pretty_contents:
|
if contents != pretty_contents:
|
||||||
|
|
@ -115,7 +115,7 @@ def pretty_format_json(argv=None):
|
||||||
if args.autofix:
|
if args.autofix:
|
||||||
_autofix(
|
_autofix(
|
||||||
json_file, pretty_contents,
|
json_file, pretty_contents,
|
||||||
encoding='utf-8' if args.no_ensure_ascii else None
|
encoding='utf-8' if args.no_ensure_ascii else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
status = 1
|
status = 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue