Debian Codegraph @

writer/sarif_test.go

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 package writer
2
3 import "os"
4
5 func ExampleSarif() {
6 w, _ := NewSarif(os.Stdout, SarifOption{ToolName: "super-linter"})
7 for _, e := range testErrs {
8 w.Write(e)
9 }
10 w.Flush()
11 // Output:
12 // {
13 // "$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.4",
14 // "runs": [
15 // {
16 // "results": [
17 // {
18 // "level": "warning",
19 // "locations": [
20 // {
21 // "physicalLocation": {
22 // "artifactLocation": {
23 // "uri": "path/to/file1",
24 // "uriBaseId": "%SRCROOT%"
25 // },
26 // "region": {
27 // "endColumn": 15,
28 // "endLine": 2,
29 // "startColumn": 14,
30 // "startLine": 1
31 // }
32 // }
33 // }
34 // ],
35 // "message": {
36 // "text": "hello"
37 // }
38 // },
39 // {
40 // "level": "note",
41 // "locations": [
42 // {
43 // "physicalLocation": {
44 // "artifactLocation": {
45 // "uri": "path/to/file1",
46 // "uriBaseId": "%SRCROOT%"
47 // },
48 // "region": {
49 // "startColumn": 14,
50 // "startLine": 2
51 // }
52 // }
53 // }
54 // ],
55 // "message": {
56 // "text": "vim"
57 // }
58 // },
59 // {
60 // "level": "error",
61 // "locations": [
62 // {
63 // "physicalLocation": {
64 // "artifactLocation": {
65 // "uri": "file2",
66 // "uriBaseId": "%SRCROOT%"
67 // },
68 // "region": {
69 // "startColumn": 14,
70 // "startLine": 2
71 // }
72 // }
73 // }
74 // ],
75 // "message": {
76 // "text": "emacs"
77 // }
78 // },
79 // {
80 // "level": "error",
81 // "locations": [
82 // {
83 // "physicalLocation": {
84 // "artifactLocation": {
85 // "uri": "file2",
86 // "uriBaseId": "%SRCROOT%"
87 // },
88 // "region": {
89 // "startColumn": 1,
90 // "startLine": 14
91 // }
92 // }
93 // }
94 // ],
95 // "message": {
96 // "text": "neovim"
97 // }
98 // }
99 // ],
100 // "tool": {
101 // "driver": {
102 // "name": "super-linter"
103 // }
104 // }
105 // }
106 // ],
107 // "version": "2.1.0"
108 // }
109 }