Skip to content

Commit

Permalink
Use non-pretty Yojson output for sarif and json-messages (closes #676)
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Apr 6, 2022
1 parent a8389e0 commit 5162202
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/framework/analyses.ml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ struct
| "sarif" ->
let open BatPrintf in
printf "Writing Sarif to file: %s\n%!" (get_string "outfile");
Yojson.Safe.pretty_to_channel ~std:true out (Sarif.to_yojson (List.rev !Messages.Table.messages_list));
Yojson.Safe.to_channel ~std:true out (Sarif.to_yojson (List.rev !Messages.Table.messages_list));
| "json-messages" ->
let files = Hashtbl.to_list Preprocessor.dependencies in
let filter_system = List.filter_map (fun (f,system) -> if system then None else Some f) in
Expand All @@ -275,7 +275,7 @@ struct
("messages", Messages.Table.to_yojson ());
]
in
Yojson.Safe.pretty_to_channel ~std:true out json
Yojson.Safe.to_channel ~std:true out json
| "none" -> ()
| s -> failwith @@ "Unsupported value for option `result`: "^s
end
Expand Down

3 comments on commit 5162202

@michael-schwarz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check if this fixes the issue?

@sim642
Copy link
Member Author

@sim642 sim642 commented on 5162202 Apr 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check on ffmpeg specifically because it takes forever to analyze, but I tested by creating a million synthetic messages, which crashed before, but didn't crash afterwards.

@michael-schwarz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'll also start a run on FFmpeg to see if it's also fixed there or some new issue surfaces for it.

Please sign in to comment.