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
beb92eac
Commit
beb92eac
authored
Oct 15, 2020
by
Andre Maroneze
💬
Committed by
Virgile Prevosto
Oct 19, 2020
Browse files
[Filepath/MdR] fix issues with PWD in to_base_uri and SARIF reports
parent
32a822dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/libraries/utils/filepath.ml
View file @
beb92eac
...
...
@@ -277,22 +277,19 @@ module Normalized = struct
with
_
->
false
let
to_base_uri
name
=
if
is_relative
name
then
None
,
skip_dot
name
else
begin
let
p
=
insert
cwd
name
in
let
buf
=
Buffer
.
create
80
in
let
res
=
add_uri_path
buf
p
in
let
uri
=
Buffer
.
contents
buf
in
let
uri
=
try
if
String
.
get
uri
0
=
'
/
'
then
String
.
sub
uri
1
(
String
.
length
uri
-
1
)
else
uri
with
Invalid_argument
_
->
uri
in
res
,
uri
end
let
p
=
insert
cwd
name
in
let
buf
=
Buffer
.
create
80
in
let
res
=
add_uri_path
buf
p
in
let
uri
=
Buffer
.
contents
buf
in
let
uri
=
try
if
String
.
get
uri
0
=
'
/
'
then
String
.
sub
uri
1
(
String
.
length
uri
-
1
)
else
uri
with
Invalid_argument
_
->
uri
in
res
,
uri
end
type
position
=
...
...
src/plugins/markdown-report/sarif_gen.ml
View file @
beb92eac
...
...
@@ -196,8 +196,8 @@ let gen_statuses () =
let
gen_artifacts
()
=
let
add_src_file
f
=
let
uri
=
Filepath
.
Normalized
.
to_
pretty_string
f
in
let
location
=
ArtifactLocation
.
create
~
uri
()
in
let
uriBaseId
,
uri
=
Filepath
.
Normalized
.
to_
base_uri
f
in
let
location
=
ArtifactLocation
.
create
~
uri
?
uriBaseId
()
in
let
roles
=
[
Role
.
analysisTarget
]
in
let
mimeType
=
"text/x-csrc"
in
Artifact
.
create
~
location
~
roles
~
mimeType
()
...
...
src/plugins/markdown-report/tests/sarif/oracle/with-libc.sarif
View file @
beb92eac
...
...
@@ -36,7 +36,7 @@
},
"artifacts": [
{
"location": { "uri": "tests/sarif/libc.c" },
"location": { "uri": "tests/sarif/libc.c"
, "uriBaseId": "PWD"
},
"roles": [ "analysisTarget" ],
"mimeType": "text/x-csrc"
}
...
...
@@ -8680,8 +8680,8 @@
{
"physicalLocation": {
"artifactLocation": {
"uri":
"/home/andr/git/frama-c-2/src/plugins/markdown-report/tests/sarif/libc.c
"
"uri":
"tests/sarif/libc.c",
"uriBaseId": "PWD
"
},
"region": {
"startLine": 13,
...
...
src/plugins/markdown-report/tests/sarif/oracle/without-libc.sarif
View file @
beb92eac
...
...
@@ -36,7 +36,7 @@
},
"artifacts": [
{
"location": { "uri": "tests/sarif/libc.c" },
"location": { "uri": "tests/sarif/libc.c"
, "uriBaseId": "PWD"
},
"roles": [ "analysisTarget" ],
"mimeType": "text/x-csrc"
}
...
...
@@ -53,8 +53,8 @@
{
"physicalLocation": {
"artifactLocation": {
"uri":
"/home/andr/git/frama-c-2/src/plugins/markdown-report/tests/sarif/libc.c
"
"uri":
"tests/sarif/libc.c",
"uriBaseId": "PWD
"
},
"region": {
"startLine": 13,
...
...
Write
Preview
Supports
Markdown
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