mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2025-08-14 09:27:21 +08:00
Continues processing JSONs even if hook fails (fixes #1038)
This commit is contained in:

committed by
Anthony Sottile

parent
8c24e2c2e6
commit
25cdd5457b
@ -115,16 +115,20 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||
f'Input File {json_file} is not a valid JSON, consider using '
|
||||
f'check-json',
|
||||
)
|
||||
return 1
|
||||
|
||||
if contents != pretty_contents:
|
||||
if args.autofix:
|
||||
_autofix(json_file, pretty_contents)
|
||||
else:
|
||||
diff_output = get_diff(contents, pretty_contents, json_file)
|
||||
sys.stdout.buffer.write(diff_output.encode())
|
||||
|
||||
status = 1
|
||||
else:
|
||||
if contents != pretty_contents:
|
||||
if args.autofix:
|
||||
_autofix(json_file, pretty_contents)
|
||||
else:
|
||||
diff_output = get_diff(
|
||||
contents,
|
||||
pretty_contents,
|
||||
json_file,
|
||||
)
|
||||
sys.stdout.buffer.write(diff_output.encode())
|
||||
|
||||
status = 1
|
||||
|
||||
return status
|
||||
|
||||
|
Reference in New Issue
Block a user