package frama-c

  1. Overview
  2. Docs

doc/src/frama-c-markdown-report.core/mdr_params.ml.html

Source file mdr_params.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
(**************************************************************************)
(*                                                                        *)
(*  SPDX-License-Identifier LGPL-2.1                                      *)
(*  Copyright (C)                                                         *)
(*  CEA (Commissariat à l'énergie atomique et aux énergies alternatives)  *)
(*                                                                        *)
(**************************************************************************)

module Pervasives_string = String

include Plugin.Register(
  struct
    let name = "Markdown report"
    let shortname = "mdr"
    let help = "generates a report in markdown format"
  end)

module Generate = String(
  struct
    let option_name = "-mdr-gen"
    let arg_name = "kind"
    let default = "none"
    let help =
      "select the <kind> of report to generate among: \
       none (default), md, draft and sarif"
  end)

module Output : Parameter_sig.Filepath =
struct
  include Filepath(
    struct
      let option_name = "-mdr-out"
      let arg_name = "f"
      let file_kind = "Report"
      let existence = Fclib.Filepath.Indifferent
      let help = "sets the name of the output file to <f>. \
                  If <f> has no extension, it is chosen automatically based on \
                  the report kind"
    end)
  let get () =
    let s = get () in
    if Pervasives_string.contains (Fclib.Filepath.basename s) '.' then s
    else
      let kind = Generate.get () in
      let ext = if kind = "sarif" then ".sarif" else ".md" in
      Fclib.Filepath.(extend s ext)
end

let () =
  Generate.set_possible_values [ "none"; "md"; "draft"; "sarif" ]

module Remarks = Filepath(
  struct
    let option_name = "-mdr-remarks"
    let arg_name = "f"
    let file_kind = "Remarks file"
    let existence = Fclib.Filepath.Must_exist
    let help =
      "reads file <f> to add additional remarks to various sections of the report. \
       Must be in a format compatible with the file produced by -mdr-gen-draft. \
       Remarks themselves must be written in pandoc's markdown, although this is \
       not enforced by the plug-in"
  end
  )

module FlameGraph = Empty_string(
  struct
    let option_name = "-mdr-flamegraph"
    let arg_name = "f"
    let help =
      "reads file <f> to include a FlameGraph (https://github.com/brendangregg/FlameGraph.git),\
       allowing the most analysis-intensive callstacks to be identified\
       quickly and accurately"
  end
  )

module Authors = String_list(
  struct
    let option_name = "-mdr-authors"
    let arg_name = "l"
    let help = "list of authors of the report"
  end)

module Title = Empty_string(
  struct
    let option_name = "-mdr-title"
    let arg_name = "t"
    let help = "title of the generated document"
  end)

module Date = Empty_string(
  struct
    let option_name = "-mdr-date"
    let arg_name = "d"
    let help = "date of the report"
  end)

module Stubs = String_list(
  struct
    let option_name = "-mdr-stubs"
    let arg_name = "f1,...,fn"
    let help = "list of C files containing stub functions"
  end)

module PrintLibc = True(
  struct
    let option_name = "-mdr-print-libc"
    let help =
      "when set (default), reports include information about libc elements."
  end)

module SarifDeterministic = False(
  struct
    let option_name = "-mdr-sarif-deterministic"
    let help = "omits non-deterministic data from SARIF reports, such as \
                absolute file URIs and timestamps."
  end)