1 write to _writer
Microsoft.CodeAnalysis (1)
CommandLine\SarifErrorLogger.cs (1)
32
_writer
= new JsonWriter(new StreamWriter(stream));
169 references to _writer
Microsoft.CodeAnalysis (169)
CommandLine\SarifErrorLogger.cs (13)
43
_writer
.Dispose();
49
_writer
.WriteObjectStart("region");
50
_writer
.Write("startLine", span.StartLinePosition.Line + 1);
51
_writer
.Write("startColumn", span.StartLinePosition.Character + 1);
52
_writer
.Write("endLine", span.EndLinePosition.Line + 1);
53
_writer
.Write("endColumn", span.EndLinePosition.Character + 1);
54
_writer
.WriteObjectEnd(); // region
95
_writer
.WriteObjectStart("properties");
99
_writer
.Write("warningLevel", diagnostic.WarningLevel);
104
_writer
.WriteObjectStart("customProperties");
108
_writer
.Write(pair.Key, pair.Value);
111
_writer
.WriteObjectEnd();
114
_writer
.WriteObjectEnd(); // properties
CommandLine\SarifV1ErrorLogger.cs (55)
36
_writer
.WriteObjectStart(); // root
37
_writer
.Write("$schema", "http://json.schemastore.org/sarif-1.0.0");
38
_writer
.Write("version", "1.0.0");
39
_writer
.WriteArrayStart("runs");
40
_writer
.WriteObjectStart(); // run
42
_writer
.WriteObjectStart("tool");
43
_writer
.Write("name", toolName);
44
_writer
.Write("version", toolAssemblyVersion.ToString());
45
_writer
.Write("fileVersion", toolFileVersion);
46
_writer
.Write("semanticVersion", toolAssemblyVersion.ToString(fieldCount: 3));
50
_writer
.Write("language", culture.Name);
52
_writer
.WriteObjectEnd(); // tool
54
_writer
.WriteArrayStart("results");
61
_writer
.WriteObjectStart(); // result
62
_writer
.Write("ruleId", diagnostic.Id);
67
_writer
.Write("ruleKey", ruleKey);
70
_writer
.Write("level", GetLevel(diagnostic.Severity));
75
_writer
.Write("message", message);
80
_writer
.WriteArrayStart("suppressionStates");
81
_writer
.Write("suppressedInSource");
82
_writer
.WriteArrayEnd();
88
_writer
.WriteObjectEnd(); // result
95
_writer
.WriteArrayStart("locations");
96
_writer
.WriteObjectStart(); // location
97
_writer
.WriteKey(PrimaryLocationPropertyName);
101
_writer
.WriteObjectEnd(); // location
102
_writer
.WriteArrayEnd(); // locations
112
_writer
.WriteArrayStart("relatedLocations");
118
_writer
.WriteObjectStart(); // annotatedCodeLocation
119
_writer
.WriteKey("physicalLocation");
123
_writer
.WriteObjectEnd(); // annotatedCodeLocation
127
_writer
.WriteArrayEnd(); // relatedLocations
142
_writer
.WriteObjectStart();
143
_writer
.Write("uri", GetUri(span.Path));
147
_writer
.WriteObjectEnd();
154
_writer
.WriteObjectStart("rules");
160
_writer
.WriteObjectStart(pair.Key); // rule
161
_writer
.Write("id", descriptor.Id);
166
_writer
.Write("shortDescription", shortDescription);
172
_writer
.Write("fullDescription", fullDescription);
175
_writer
.Write("defaultLevel", GetLevel(descriptor.DefaultSeverity));
179
_writer
.Write("helpUri", descriptor.HelpLinkUri);
182
_writer
.WriteObjectStart("properties");
186
_writer
.Write("category", descriptor.Category);
189
_writer
.Write("isEnabledByDefault", descriptor.IsEnabledByDefault);
193
_writer
.WriteArrayStart("tags");
197
_writer
.Write(tag);
200
_writer
.WriteArrayEnd(); // tags
203
_writer
.WriteObjectEnd(); // properties
204
_writer
.WriteObjectEnd(); // rule
207
_writer
.WriteObjectEnd(); // rules
213
_writer
.WriteArrayEnd(); // results
217
_writer
.WriteObjectEnd(); // run
218
_writer
.WriteArrayEnd(); // runs
219
_writer
.WriteObjectEnd(); // root
CommandLine\SarifV2ErrorLogger.cs (101)
45
_writer
.WriteObjectStart(); // root
46
_writer
.Write("$schema", "http://json.schemastore.org/sarif-2.1.0");
47
_writer
.Write("version", "2.1.0");
48
_writer
.WriteArrayStart("runs");
49
_writer
.WriteObjectStart(); // run
51
_writer
.WriteArrayStart("results");
58
_writer
.WriteObjectStart(); // result
59
_writer
.Write("ruleId", diagnostic.Id);
61
_writer
.Write("ruleIndex", ruleIndex);
63
_writer
.Write("level", GetLevel(diagnostic.Severity));
68
_writer
.WriteObjectStart("message");
69
_writer
.Write("text", message);
70
_writer
.WriteObjectEnd();
77
_writer
.WriteArrayStart("suppressions");
78
_writer
.WriteObjectStart(); // suppression
79
_writer
.Write("kind", "inSource");
83
_writer
.Write("justification", justification);
102
_writer
.WriteObjectStart("properties");
104
_writer
.Write("suppressionType", suppressionType);
106
_writer
.WriteObjectEnd(); // properties
109
_writer
.WriteObjectEnd(); // suppression
110
_writer
.WriteArrayEnd();
117
_writer
.WriteObjectEnd(); // result
134
_writer
.WriteArrayStart("locations");
135
_writer
.WriteObjectStart(); // location
136
_writer
.WriteKey(PrimaryLocationPropertyName);
140
_writer
.WriteObjectEnd(); // location
141
_writer
.WriteArrayEnd(); // locations
151
_writer
.WriteArrayStart("relatedLocations");
157
_writer
.WriteObjectStart(); // annotatedCodeLocation
158
_writer
.WriteKey("physicalLocation");
162
_writer
.WriteObjectEnd(); // annotatedCodeLocation
166
_writer
.WriteArrayEnd(); // relatedLocations
176
_writer
.WriteObjectStart(); // physicalLocation
178
_writer
.WriteObjectStart("artifactLocation");
179
_writer
.Write("uri", GetUri(span.Path));
180
_writer
.WriteObjectEnd(); // artifactLocation
184
_writer
.WriteObjectEnd();
189
_writer
.WriteArrayEnd(); //results
193
_writer
.WriteObjectStart("properties");
195
_writer
.Write("analyzerExecutionTime", _totalAnalyzerExecutionTime);
197
_writer
.WriteObjectEnd(); // properties
202
_writer
.Write("columnKind", "utf16CodeUnits");
204
_writer
.WriteObjectEnd(); // run
205
_writer
.WriteArrayEnd(); // runs
206
_writer
.WriteObjectEnd(); // root
212
_writer
.WriteObjectStart("tool");
213
_writer
.WriteObjectStart("driver");
214
_writer
.Write("name", _toolName);
215
_writer
.Write("version", _toolFileVersion);
216
_writer
.Write("dottedQuadFileVersion", _toolAssemblyVersion.ToString());
217
_writer
.Write("semanticVersion", _toolAssemblyVersion.ToString(fieldCount: 3));
221
_writer
.Write("language", _culture.Name);
224
_writer
.WriteObjectEnd(); // driver
225
_writer
.WriteObjectEnd(); // tool
236
_writer
.WriteArrayStart("rules");
241
_writer
.WriteObjectStart(); // rule
242
_writer
.Write("id", descriptor.Id);
247
_writer
.WriteObjectStart("shortDescription");
248
_writer
.Write("text", shortDescription);
249
_writer
.WriteObjectEnd();
255
_writer
.WriteObjectStart("fullDescription");
256
_writer
.Write("text", fullDescription);
257
_writer
.WriteObjectEnd();
264
_writer
.Write("helpUri", descriptor.HelpLinkUri);
281
_writer
.WriteObjectStart("properties");
285
_writer
.Write("category", descriptor.Category);
290
_writer
.Write("isEverSuppressed", "true");
292
_writer
.WriteArrayStart("suppressionKinds");
296
_writer
.Write("external");
301
_writer
.Write("inSource");
304
_writer
.WriteArrayEnd(); // suppressionKinds
310
_writer
.Write("executionTimeInSeconds", executionTime);
313
_writer
.Write("executionTimeInPercentage", executionPercentage);
318
_writer
.WriteArrayStart("tags");
322
_writer
.Write(tag);
325
_writer
.WriteArrayEnd(); // tags
328
_writer
.WriteObjectEnd(); // properties
331
_writer
.WriteObjectEnd(); // rule
342
_writer
.WriteArrayEnd(); // rules
375
_writer
.WriteArrayStart("invocations");
376
_writer
.WriteObjectStart(); // invocation
381
_writer
.Write("executionSuccessful", true);
383
_writer
.WriteArrayStart("ruleConfigurationOverrides");
391
_writer
.WriteObjectStart(); // ruleConfigurationOverride
393
_writer
.WriteObjectStart("descriptor");
394
_writer
.Write("id", id);
395
_writer
.Write("index", index);
396
_writer
.WriteObjectEnd(); // descriptor
400
_writer
.WriteObjectStart("configuration");
404
_writer
.Write("enabled", false);
409
_writer
.Write("level", level);
411
_writer
.WriteObjectEnd(); // configuration
413
_writer
.WriteObjectEnd(); // ruleConfigurationOverride
417
_writer
.WriteArrayEnd(); // ruleConfigurationOverrides
419
_writer
.WriteObjectEnd(); // invocation
420
_writer
.WriteArrayEnd(); // invocations
435
_writer
.WriteObjectStart("defaultConfiguration");
439
_writer
.Write("level", defaultLevel);
444
_writer
.Write("enabled", descriptor.IsEnabledByDefault);
447
_writer
.WriteObjectEnd(); // defaultConfiguration