mirror of
https://github.com/hohn/codeql-intro-csharp.git
synced 2025-12-16 10:43:05 +01:00
Run analysis using given script and database
This commit is contained in:
committed by
=Michael Hohn
parent
450b9897a1
commit
2a4a0d5413
60
sarif-summary.jq
Normal file
60
sarif-summary.jq
Normal file
@@ -0,0 +1,60 @@
|
||||
# -*- sh -*-
|
||||
.runs | .[] | .results | .[] |
|
||||
( (.ruleId, ": ",
|
||||
(.message.text | split("\n") | ( .[0], " [", length-1 , " more]")),
|
||||
"\n")
|
||||
,
|
||||
(if (.codeFlows != null) then
|
||||
(.codeFlows | .[] |
|
||||
(" Path\n"
|
||||
,
|
||||
( .threadFlows | .[] | .locations | .[] | .location | " "
|
||||
,
|
||||
( .physicalLocation | ( .artifactLocation.uri, ":", .region.startLine, ":"))
|
||||
,
|
||||
(.message.text, " ")
|
||||
,
|
||||
"\n"
|
||||
)))
|
||||
else
|
||||
(.locations | .[] |
|
||||
( " "
|
||||
,
|
||||
(.physicalLocation | ( .artifactLocation.uri, ":", .region.startLine, ":"))
|
||||
))
|
||||
,
|
||||
# .message.text,
|
||||
"\n"
|
||||
end)
|
||||
) | tostring
|
||||
|
||||
# This script extracts the following parts of the sarif output:
|
||||
#
|
||||
# # problem
|
||||
# "runs" : [ {
|
||||
# "results" : [ {
|
||||
# "ruleId" : "cpp/UncheckedErrorCode",
|
||||
|
||||
# # path problem
|
||||
# "runs" : [ {
|
||||
# "tool" : {
|
||||
# "driver" : {
|
||||
# "rules" : [ {
|
||||
# "properties" : {
|
||||
# "kind" : "path-problem",
|
||||
|
||||
# "runs" : [ {
|
||||
# "results" : [ {
|
||||
# "ruleId" : "cpp/DangerousArithmetic",
|
||||
# "ruleIndex" : 6,
|
||||
# "message" : {
|
||||
# "text" : "Potential overflow (conversion: int -> unsigned int)\nPotential overflow (con
|
||||
|
||||
# "runs" : [ {
|
||||
# "results" : [ {
|
||||
# "codeFlows" : [ {
|
||||
# "threadFlows" : [ {
|
||||
# "locations" : [ {
|
||||
# "location" : {
|
||||
# "message" : {
|
||||
# "text" : "buff"
|
||||
Reference in New Issue
Block a user