You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pretty-format-json prints "Input File {json_file} is not a valid JSON, consider using check-json" when it encounters an incorrectly formatted JSON file (e.g. with JSON5 comments), but it's not clear from that message that it then stops further processing files.
As pre-commit can partition the processed files into batches, this makes it even harder to tell as multiple batches of files can fail midway through with a few "X is not a valid JSON" messages printed, giving the impression that all the JSONs were formatted (or attempted formatted) and only those files printed are incorrect. The reality is that some JSONs may not have been formatted. I think this hook should try to format every JSON and only fail at the end if any have an invalid JSON format.
The text was updated successfully, but these errors were encountered:
amarvin
changed the title
pretty-format-json --all-files stops formatting JSONs when it encounters one with incorrect format (e.g. JSON5 comments)pretty-format-json stops formatting JSONs when it encounters one with incorrect format (e.g. JSON5 comments)
Apr 12, 2024
amarvin
added a commit
to amarvin/pre-commit-hooks
that referenced
this issue
Apr 12, 2024
Transferred from pre-commit/pre-commit#3124.
pretty-format-json
prints "Input File {json_file} is not a valid JSON, consider using check-json" when it encounters an incorrectly formatted JSON file (e.g. with JSON5 comments), but it's not clear from that message that it then stops further processing files.As
pre-commit
can partition the processed files into batches, this makes it even harder to tell as multiple batches of files can fail midway through with a few "X is not a valid JSON" messages printed, giving the impression that all the JSONs were formatted (or attempted formatted) and only those files printed are incorrect. The reality is that some JSONs may not have been formatted. I think this hook should try to format every JSON and only fail at the end if any have an invalid JSON format.The text was updated successfully, but these errors were encountered: