Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
dff513ae
Commit
dff513ae
authored
5 years ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[sarif] add statuses of properties to the sarif output
parent
ba1ea501
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/markdown-report/sarif_gen.ml
+32
-0
32 additions, 0 deletions
src/plugins/markdown-report/sarif_gen.ml
with
32 additions
and
0 deletions
src/plugins/markdown-report/sarif_gen.ml
+
32
−
0
View file @
dff513ae
...
@@ -50,6 +50,37 @@ let gen_results remarks =
...
@@ -50,6 +50,37 @@ let gen_results remarks =
let
_
,
content
=
Alarms
.
fold
treat_alarm
(
0
,
[]
)
in
let
_
,
content
=
Alarms
.
fold
treat_alarm
(
0
,
[]
)
in
List
.
rev
content
List
.
rev
content
let
is_alarm
=
function
|
Property
.
IPCodeAnnot
(
_
,_,
ca
)
->
Extlib
.
has_some
(
Alarms
.
find
ca
)
|
_
->
false
let
level_of_status
=
let
open
Property_status
.
Feedback
in
let
open
Sarif
.
Result_level
in
function
|
Never_tried
->
notApplicable
|
Considered_valid
|
Valid
|
Valid_under_hyp
|
Valid_but_dead
->
pass
|
Unknown
|
Unknown_but_dead
->
warning
|
Invalid
|
Invalid_under_hyp
|
Invalid_but_dead
->
error
|
Inconsistent
->
note
let
make_ip_message
ip
=
let
text
=
Format
.
asprintf
"@[%a@]"
Property
.
short_pretty
ip
in
Message
.
plain_text
~
text
()
let
gen_status
ip
=
let
status
=
Property_status
.
Feedback
.
get
ip
in
let
level
=
level_of_status
status
in
let
locations
=
[
Location
.
of_loc
(
Property
.
location
ip
)
]
in
let
message
=
make_ip_message
ip
in
Sarif_result
.
create
~
level
~
locations
~
message
()
let
gen_statuses
()
=
let
f
ip
content
=
if
is_alarm
ip
then
content
else
(
gen_status
ip
)
::
content
in
List
.
rev
(
Property_status
.
fold
f
[]
)
let
gen_files
()
=
let
gen_files
()
=
let
add_src_file
f
=
let
add_src_file
f
=
let
key
=
Filename
.
chop_extension
(
Filename
.
basename
f
)
in
let
key
=
Filename
.
chop_extension
(
Filename
.
basename
f
)
in
...
@@ -64,6 +95,7 @@ let gen_run remarks =
...
@@ -64,6 +95,7 @@ let gen_run remarks =
let
tool
=
frama_c_sarif
in
let
tool
=
frama_c_sarif
in
let
invocations
=
[
gen_invocation
()
]
in
let
invocations
=
[
gen_invocation
()
]
in
let
results
=
gen_results
remarks
in
let
results
=
gen_results
remarks
in
let
results
=
results
@
(
gen_statuses
()
)
in
let
files
=
gen_files
()
in
let
files
=
gen_files
()
in
Run
.
create
~
tool
~
invocations
~
results
~
files
()
Run
.
create
~
tool
~
invocations
~
results
~
files
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment