From 757f47498b6bfd6294c201b5c443e5ae05d29ab3 Mon Sep 17 00:00:00 2001 From: ascheucher-shopify-partner <140156444+ascheucher-shopify-partner@users.noreply.github.com> Date: Fri, 21 Feb 2025 19:08:54 +0100 Subject: [PATCH] fixed test failure --- pre_commit_hooks/pretty_format_json.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pre_commit_hooks/pretty_format_json.py b/pre_commit_hooks/pretty_format_json.py index 01bfd7f..a9738df 100644 --- a/pre_commit_hooks/pretty_format_json.py +++ b/pre_commit_hooks/pretty_format_json.py @@ -141,7 +141,11 @@ def main(argv: Sequence[str] | None = None) -> int: if args.autofix: _autofix(json_file, pretty_contents) if args.empty_object_with_newline: + # When using --empty-object-with-newline with --autofix, + # we want to return success after fixing status = 0 + else: + status = 1 else: diff_output = get_diff( contents, @@ -149,8 +153,7 @@ def main(argv: Sequence[str] | None = None) -> int: json_file ) sys.stdout.buffer.write(diff_output.encode()) - - status = 1 + status = 1 return status