Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pub
frama-c
Commits
84f54ed0
Commit
84f54ed0
authored
Oct 08, 2020
by
Andre Maroneze
💬
Committed by
Virgile Prevosto
Oct 19, 2020
Browse files
[Markdown-report] pretty-print paths and add baseUris
parent
b876bf4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/markdown-report/sarif.ml
View file @
84f54ed0
...
@@ -98,10 +98,8 @@ module ArtifactLocation = struct
...
@@ -98,10 +98,8 @@ module ArtifactLocation = struct
let
default
=
create
~
uri
:
""
()
let
default
=
create
~
uri
:
""
()
let
of_loc
loc
=
let
of_loc
loc
=
let
open
Filepath
in
let
uriBaseId
,
uri
=
Filepath
.(
Normalized
.
to_base_uri
(
fst
loc
)
.
pos_path
)
in
(* by construction, we have an absolute path here, no need for uriBase *)
create
~
uri
?
uriBaseId
()
let
uri
=
((
fst
loc
)
.
pos_path
:>
string
)
in
create
~
uri
()
end
end
module
ArtifactLocationDictionary
=
Json_dictionary
(
ArtifactLocation
)
module
ArtifactLocationDictionary
=
Json_dictionary
(
ArtifactLocation
)
...
...
src/plugins/markdown-report/sarif_gen.ml
View file @
84f54ed0
...
@@ -159,7 +159,7 @@ let gen_statuses () =
...
@@ -159,7 +159,7 @@ let gen_statuses () =
let
gen_artifacts
()
=
let
gen_artifacts
()
=
let
add_src_file
f
=
let
add_src_file
f
=
let
uri
=
(
f
:
Filepath
.
Normalized
.
t
:>
string
)
in
let
uri
=
Filepath
.
Normalized
.
t
o_pretty_
string
f
in
let
location
=
ArtifactLocation
.
create
~
uri
()
in
let
location
=
ArtifactLocation
.
create
~
uri
()
in
let
roles
=
[
Role
.
analysisTarget
]
in
let
roles
=
[
Role
.
analysisTarget
]
in
let
mimeType
=
"text/x-csrc"
in
let
mimeType
=
"text/x-csrc"
in
...
@@ -192,7 +192,19 @@ let gen_run remarks =
...
@@ -192,7 +192,19 @@ let gen_run remarks =
let
taxonomies
=
[
ToolComponent
.
create
~
name
~
rules
()
]
in
let
taxonomies
=
[
ToolComponent
.
create
~
name
~
rules
()
]
in
let
results
=
results
@
user_annot_results
in
let
results
=
results
@
user_annot_results
in
let
artifacts
=
gen_artifacts
()
in
let
artifacts
=
gen_artifacts
()
in
Run
.
create
~
tool
~
invocations
~
results
~
taxonomies
~
artifacts
()
let
uriBases
=
(
"PWD"
,
Sys
.
getcwd
()
)
::
Filepath
.
all_symbolic_dirs
()
in
let
uriBasesJson
=
List
.
fold_left
(
fun
acc
(
name
,
dir
)
->
(
name
,
`Assoc
[(
"uri"
,
`String
dir
)])
::
acc
)
[]
uriBases
in
let
originalUriBaseIds
=
match
ArtifactLocationDictionary
.
of_yojson
(
`Assoc
uriBasesJson
)
with
|
Ok
x
->
x
|
Error
s
->
failwith
s
in
Run
.
create
~
tool
~
invocations
~
results
~
taxonomies
~
artifacts
~
originalUriBaseIds
()
let
generate
()
=
let
generate
()
=
let
remarks
=
get_remarks
()
in
let
remarks
=
get_remarks
()
in
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment