GeezerVison is showing github.com — `pretty-format-json` stops formatting JSONs when it encounters one with incorrect format (e.g. JSON5 comments) · Issue #1038 · pre-commit/pre-commit-hooks
pretty-format-json stops formatting JSONs when it encounters one with incorrect format (e.g. JSON5 comments) #1038
Description
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.
Activity
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)[/+] on Apr 12, 2024added a commit that references this issue
on Apr 20, 2024This issue will close once commit 528a309 is merged into the 'main' branch.528a309
Metadata
Metadata
Development
No branches or pull requestsIssue actions