Commit 97784ac9 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[sarif] generate information about input files

parent 3e0a66ab
......@@ -644,6 +644,25 @@ module File = struct
lastModifiedTime: (string [@default ""]);
properties: (Properties.t [@default Properties.default]);
}[@@deriving yojson]
let create
?(fileLocation = FileLocation.default)
?(parentKey = "")
?(offset = 0)
?(length = 0)
?(roles = [])
?(mimeType = "")
?(contents = FileContent.default)
?(encoding = "")
?(hashes = [])
?(lastModifiedTime = "")
?(properties = Properties.default)
()
=
{
fileLocation; parentKey; offset; length; roles; mimeType; contents;
encoding; hashes; lastModifiedTime; properties
}
end
module FileChange = struct
......
......@@ -50,11 +50,22 @@ let gen_results remarks =
let _, content = Alarms.fold treat_alarm (0, []) in
List.rev content
let gen_files () =
let add_src_file f =
let key = Filename.chop_extension (Filename.basename f) in
let fileLocation = FileLocation.create ~uri:(Filepath.normalize f) () in
let roles = [ Role.analysisTarget ] in
let mimeType = "text/x-csrc" in
key, File.create ~fileLocation ~roles ~mimeType ()
in
List.map add_src_file (Kernel.Files.get ())
let gen_run remarks =
let tool = frama_c_sarif in
let invocations = [gen_invocation ()] in
let results = gen_results remarks in
Run.create ~tool ~invocations ~results ()
let files = gen_files () in
Run.create ~tool ~invocations ~results ~files ()
let generate () =
let remarks = get_remarks () in
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment