Skip to content

Commit 757f474

Browse files
fixed test failure
1 parent 15d9beb commit 757f474

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pre_commit_hooks/pretty_format_json.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,19 @@ def main(argv: Sequence[str] | None = None) -> int:
141141
if args.autofix:
142142
_autofix(json_file, pretty_contents)
143143
if args.empty_object_with_newline:
144+
# When using --empty-object-with-newline with --autofix,
145+
# we want to return success after fixing
144146
status = 0
147+
else:
148+
status = 1
145149
else:
146150
diff_output = get_diff(
147151
contents,
148152
pretty_contents,
149153
json_file
150154
)
151155
sys.stdout.buffer.write(diff_output.encode())
152-
153-
status = 1
156+
status = 1
154157

155158
return status
156159

0 commit comments

Comments
 (0)