-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathto-rdjson.jq
31 lines (31 loc) · 871 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
# Convert hadolint JSON output to Reviewdog Diagnostic Format (rdjson)
# https://github.com/reviewdog/reviewdog/blob/f577bd4b56e5973796eb375b4205e89bce214bd9/proto/rdf/reviewdog.proto
{
source: {
name: "hadolint",
url: "https://github.com/hadolint/hadolint"
},
diagnostics: . | map({
message: .message,
code: {
value: .code,
url: (if .code | startswith("DL") then
"https://github.com/hadolint/hadolint/wiki/\(.code)"
elif .code | startswith("SC") then
"https://github.com/koalaman/shellcheck/wiki/\(.code)"
else
null
end),
} ,
location: {
path: .file,
range: {
start: {
line: .line,
column: .column
}
}
},
severity: ((.level|ascii_upcase|select(match("ERROR|WARNING|INFO")))//null)
})
}