diff --git a/src/plugins/markdown-report/sarif.ml b/src/plugins/markdown-report/sarif.ml index 17010d7b7c3b41279a41a3758df6decc173ab195..cc93381f795d59631cde8ee0336ffed2d048fd17 100644 --- a/src/plugins/markdown-report/sarif.ml +++ b/src/plugins/markdown-report/sarif.ml @@ -379,33 +379,64 @@ type t = { properties: (Properties.t [@default Properties.default]); }[@@deriving yojson] - let default = { - commandLine = "/bin/cat"; - arguments = []; - responseFiles = []; - attachments = []; - startTime = ""; - endTime = ""; - exitCode = 0; - toolNotifications = []; - configurationNotifications = []; - exitCodeDescription = ""; - exitSignalName = ""; - exitSignalNumber = 0; - processStartFailureMessage = ""; - toolExecutionSuccessful = true; - machine = ""; - account = ""; - processId = 0; - executableLocation = FileLocation.default; - workingDirectory = FileLocation.default; - environmentVariables = Additional_properties.default; - stdin = FileLocation.default; - stdout = FileLocation.default; - stderr = FileLocation.default; - stdoutStderr = FileLocation.default; - properties = Properties.default; - } + let create + ~commandLine + ?(arguments = []) + ?(responseFiles = []) + ?(attachments = []) + ?(startTime = "") + ?(endTime = "") + ?(exitCode = 0) + ?(toolNotifications = []) + ?(configurationNotifications = []) + ?(exitCodeDescription = "") + ?(exitSignalName = "") + ?(exitSignalNumber = 0) + ?(processStartFailureMessage = "") + ?(toolExecutionSuccessful = true) + ?(machine = "") + ?(account = "") + ?(processId = 0) + ?(executableLocation = FileLocation.default) + ?(workingDirectory = FileLocation.default) + ?(environmentVariables = Additional_properties.default) + ?(stdin = FileLocation.default) + ?(stdout = FileLocation.default) + ?(stderr = FileLocation.default) + ?(stdoutStderr = FileLocation.default) + ?(properties = Properties.default) + () + = + { + commandLine; + arguments; + responseFiles; + attachments; + startTime; + endTime; + exitCode; + toolNotifications; + configurationNotifications; + exitCodeDescription; + exitSignalName; + exitSignalNumber; + processStartFailureMessage; + toolExecutionSuccessful; + machine; + account; + processId; + executableLocation; + workingDirectory; + environmentVariables; + stdin; + stdout; + stderr; + stdoutStderr; + properties; + } + + let default = create ~commandLine:"/bin/true" () + end module Conversion = struct diff --git a/src/plugins/markdown-report/sarif_gen.ml b/src/plugins/markdown-report/sarif_gen.ml index cb02eda97e7916e133aedb87c2a724c7f3453268..b75d9d2f0fb3f3864639999246cc1a438b64a40e 100644 --- a/src/plugins/markdown-report/sarif_gen.ml +++ b/src/plugins/markdown-report/sarif_gen.ml @@ -6,7 +6,7 @@ let frama_c_sarif = let semanticVersion = Config.version in let fullName = name ^ "-" ^ version in let downloadUri = "https://frama-c.com/download.html" in - let sarifLoggerVersion = Mdr_params.version in + let sarifLoggerVersion = Mdr_version.version in Tool.create ~name ~version ~semanticVersion ~fullName ~downloadUri ~sarifLoggerVersion () @@ -16,9 +16,14 @@ let get_remarks () = if f <> "" then Parse_remarks.get_remarks f else Datatype.String.Map.empty +let gen_invocation () = + let commandLine = Array.fold_right (fun s acc -> s ^ " " ^ acc) Sys.argv "" in + let arguments = List.tl (Array.to_list Sys.argv) in + Invocation.create ~commandLine ~arguments () + let gen_run () = let tool = frama_c_sarif in - let invocations = [] in + let invocations = [gen_invocation ()] in Run.create ~tool ~invocations () let generate () =