generated from reviewdog/action-composite-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
to-rdjsonl.jq
46 lines (46 loc) · 1.15 KB
/
to-rdjsonl.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
35
36
37
38
39
40
41
42
43
44
45
46
.[] |
. as $item |
{
"message": (if .note then (.message + " (Note: " + .note + ")") else .message end),
"severity": .severity | ascii_upcase,
"location": {
"path": .file,
"range": {
"start": {
"line": (.range.start.line + 1),
"column": (.range.start.column + 1)
},
"end": {
"line": (.range.end.line + 1),
"column": (.range.end.column + 1)
}
}
},
"code": {
"value": .ruleId,
"url": "https://github.com/ast-grep/ast-grep"
},
"source": {
"name": "ast-grep",
"url": "https://github.com/ast-grep/ast-grep"
},
"original_output": . | tostring
} + if .replacement then
{
"suggestions": [
{
"range": {
"start": {
"line": (.range.start.line + 1),
"column": (.range.start.column + 1)
},
"end": {
"line": (.range.end.line + 1),
"column": (.range.end.column + 1)
}
},
"text": .replacement
}
]
}
else {} end