forked from reviewdog/reviewdog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreviewdog.proto
236 lines (207 loc) · 5.87 KB
/
reviewdog.proto
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// Reviewdog Diagnostic Format
//
// Reviewdog Diagnostic Format defines generic machine readable message
// structures which represents a result of diagnostic tool such as a compiler
// or a linter.
//
// The idea behind the Reviewdog Diagnostic Format is to standardize
// the protocol for how diagnostic tools (e.g. compilers, linters, etc..) and
// development tools (e.g. editors, reviewdog, etc..) communicate.
//
// Wire formats of Reviewdog Diagnostic Format.
// - rdjsonl: JSON Lines (http://jsonlines.org/) of the `Diagnostic` message.
// - rdjson: JSON format of the `DiagnosticResult` message.
syntax = "proto3";
package reviewdog.rdf;
option go_package = "github.com/reviewdog/reviewdog/proto/rdf";
// Result of diagnostic tool such as a compiler or a linter.
// It's intended to be used as top-level structured format which represents a
// whole result of a diagnostic tool.
message DiagnosticResult {
repeated Diagnostic diagnostics = 1;
// The source of diagnostics, e.g. 'typescript' or 'super lint'.
// Optional.
Source source = 2;
// This diagnostics' overall severity.
// Optional.
Severity severity = 3;
}
// Represents a diagnostic, such as a compiler error or warning.
// It's intended to be used as structured format which represents a
// diagnostic and can be used as stream of input/output such as jsonl.
// This message should be self-contained to report a diagnostic.
message Diagnostic {
// The diagnostic's message.
string message = 1;
// Location at which this diagnostic message applies.
Location location = 2;
// This diagnostic's severity.
// Optional.
Severity severity = 3;
// The source of this diagnostic, e.g. 'typescript' or 'super lint'.
// Optional.
Source source = 4;
// This diagnostic's rule code.
// Optional.
Code code = 5;
// Suggested fixes to resolve this diagnostic.
// Optional.
repeated Suggestion suggestions = 6;
// Experimental: If this diagnostic is converted from other formats,
// original_output represents the original output which corresponds to this
// diagnostic.
// Optional.
string original_output = 7;
// Related locations for this diagnostic.
// Optional.
repeated RelatedLocation related_locations = 8;
}
enum Severity {
UNKNOWN_SEVERITY = 0;
ERROR = 1;
WARNING = 2;
INFO = 3;
}
message Location {
// File path. It could be either absolute path or relative path.
string path = 2;
// Range in the file path.
// Optional.
Range range = 3;
}
message RelatedLocation {
// Explanation of this related location.
// Optional.
string message = 1;
// Required.
Location location = 2;
}
// A range in a text document expressed as start and end positions.
// The end position is *exclusive*. It might be a bit unnatural for you or for
// some diagnostic tools to use exclusive range, but it's necessary to represent
// zero-width range especially when using it in Suggestion context to support
// code insertion.
// Example: "14" in "haya14busa"
// start: { line: 1, column: 5 }
// end: { line: 1, column: 7 } # <= Exclusive
//
// |h|a|y|a|1|4|b|u|s|a|
// 1 2 3 4 5 6 7 8 9 0 1
// ^---^
// haya14busa
// ^^
//
// If you want to specify a range that
// contains a line including the line ending character(s), then use an end
// position denoting the start of the next line.
// Example:
// start: { line: 5, column: 23 }
// end: { line: 6, column: 1 }
//
// If both start and end position omit column value, it's
// handled as linewise and the range includes end position (line) as well.
// Example:
// start: { line: 5 }
// end: { line: 6 }
// The above example represents range start from line 5 to the end of line 6
// including EOL.
//
// Examples for line range:
// Text example. <line>|<line content>(line breaking)
// 1|abc\r\n
// 2|def\r\n
// 3|ghi\r\n
//
// start: { line: 2 }
// => "abc"
//
// start: { line: 2 }
// end: { line: 2 }
// => "abc"
//
// start: { line: 2 }
// end: { line: 3 }
// => "abc\r\ndef"
//
// start: { line: 2 }
// end: { line: 3, column: 1 }
// => "abc\r\n"
// start: { line: 2, column: 1 }
// end: { line: 2, column: 4 }
// => "abc" (without line-break)
message Range {
// Required.
Position start = 1;
// end can be omitted. Then the range is handled as zero-length (start == end).
// Optional.
Position end = 2;
}
message Position {
// Line number, starting at 1.
// Optional.
int32 line = 1;
// Column number, starting at 1 (byte count in UTF-8).
// Example: 'a𐐀b'
// The column of a: 1
// The column of 𐐀: 2
// The column of b: 6 since 𐐀 is represented with 4 bytes in UTF-8.
// Optional.
int32 column = 2;
}
// Suggestion represents a suggested text manipulation to resolve a diagnostic
// problem.
//
// Insert example ('hayabusa' -> 'haya15busa'):
// range {
// start {
// line: 1
// column: 5
// }
// end {
// line: 1
// column: 5
// }
// }
// text: 15
// |h|a|y|a|b|u|s|a|
// 1 2 3 4 5 6 7 8 9
// ^--- insert '15'
//
// Update example ('haya15busa' -> 'haya14busa'):
// range {
// start {
// line: 1
// column: 5
// }
// end {
// line: 1
// column: 7
// }
// }
// text: 14
// |h|a|y|a|1|5|b|u|s|a|
// 1 2 3 4 5 6 7 8 9 0 1
// ^---^ replace with '14'
message Suggestion {
// Range at which this suggestion applies.
// To insert text into a document create a range where start == end.
Range range = 1;
// A suggested text which replace the range.
// For delete operations use an empty string.
string text = 2;
}
message Source {
// A human-readable string describing the source of diagnostics, e.g.
// 'typescript' or 'super lint'.
string name = 1;
// URL to this source.
// Optional.
string url = 2;
}
message Code {
// This rule's code/identifier.
string value = 1;
// A URL to open with more information about this rule code.
// Optional.
string url = 2;
}