-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
to-rdjson.jq
34 lines (34 loc) · 927 Bytes
/
to-rdjson.jq
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
# Convert TFsec JSON output to Reviewdog Diagnostic Format (rdjson)
# https://github.com/reviewdog/reviewdog/blob/f577bd4b56e5973796eb375b4205e89bce214bd9/proto/rdf/reviewdog.proto
{
source: {
name: "tfsec",
url: "https://github.com/aquasecurity/tfsec"
},
diagnostics: (.results // {}) | map({
message: .description,
code: {
value: .rule_id,
url: .links[0],
} ,
location: {
path: .location.filename,
range: {
start: {
line: .location.start_line,
},
}
},
severity: (if .severity | startswith("CRITICAL") then
"ERROR"
elif .severity | startswith("HIGH") then
"ERROR"
elif .severity | startswith("MEDIUM") then
"WARNING"
elif .severity | startswith("LOW") then
"INFO"
else
null
end),
})
}