@cplieger/deadset-ts 8.0.0-dev.4 → 8.0.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/src/analysis.js +3 -3
  2. package/dist/src/config.js +1 -1
  3. package/dist/src/conformance-record.js +1 -1
  4. package/dist/src/contract/contract.generated.js +1071 -0
  5. package/dist/src/contract/report.generated.js +796 -0
  6. package/dist/src/convention-rows.js +1 -1
  7. package/dist/src/exempt-classes.js +1 -59
  8. package/dist/src/exempt.js +8 -19
  9. package/dist/src/findings/completion.js +11 -20
  10. package/dist/src/findings/dependencies-and-module-machinery.js +4 -5
  11. package/dist/src/findings/emitters.js +4 -4
  12. package/dist/src/findings/interfaces.js +4 -5
  13. package/dist/src/findings/intra-function.js +8 -7
  14. package/dist/src/findings/non-code-artifacts.js +5 -6
  15. package/dist/src/findings/reads-and-writes.js +9 -8
  16. package/dist/src/findings/self-check.js +7 -10
  17. package/dist/src/findings/unused-declarations.js +28 -27
  18. package/dist/src/findings/visibility-narrowing.js +9 -11
  19. package/dist/src/findings-pass.js +1 -3
  20. package/dist/src/index.js +1 -1
  21. package/dist/src/intra-function-parts.js +8 -13
  22. package/dist/src/kinds.js +4 -360
  23. package/dist/src/report-schema.js +273 -0
  24. package/dist/src/report.js +17 -11
  25. package/dist/src/resolve.js +1 -6
  26. package/dist/src/run.js +2 -1
  27. package/dist/src/setup-failure.js +2 -6
  28. package/dist/src/suppress-file.js +4 -3
  29. package/dist/src/suppress-inline.js +3 -2
  30. package/dist/src/suppress.js +29 -48
  31. package/dist/src/verbs/analyze.js +7 -2
  32. package/dist/src/verbs/describe.js +4 -4
  33. package/dist/src/verbs/explain.js +2 -1
  34. package/dist/src/verbs/print-config.js +2 -1
  35. package/dist/src/verbs/print-projects.js +2 -1
  36. package/dist/src/verbs/print-retained.js +2 -1
  37. package/dist/src/verbs/print-roots.js +2 -1
  38. package/dist/src/verbs/verb.js +1 -5
  39. package/dist/src/verbs/version.js +2 -2
  40. package/jsr.json +1 -1
  41. package/package.json +3 -2
  42. package/src/analysis.ts +3 -3
  43. package/src/config.ts +7 -13
  44. package/src/conformance-record.ts +1 -1
  45. package/src/contract/contract.generated.ts +1123 -0
  46. package/src/contract/report.generated.ts +1157 -0
  47. package/src/convention-rows.ts +1 -1
  48. package/src/exempt-classes.ts +1 -70
  49. package/src/exempt.ts +12 -20
  50. package/src/finding.ts +9 -9
  51. package/src/findings/completion.ts +22 -23
  52. package/src/findings/dependencies-and-module-machinery.ts +4 -7
  53. package/src/findings/emitter.ts +6 -7
  54. package/src/findings/emitters.ts +6 -6
  55. package/src/findings/interfaces.ts +4 -6
  56. package/src/findings/intra-function.ts +8 -8
  57. package/src/findings/non-code-artifacts.ts +5 -7
  58. package/src/findings/reads-and-writes.ts +13 -11
  59. package/src/findings/self-check.ts +8 -15
  60. package/src/findings/unused-declarations.ts +28 -27
  61. package/src/findings/visibility-narrowing.ts +9 -12
  62. package/src/findings-pass.ts +1 -4
  63. package/src/index.ts +1 -1
  64. package/src/intra-function-parts.ts +8 -14
  65. package/src/kinds.ts +6 -406
  66. package/src/report-schema.ts +366 -0
  67. package/src/report.ts +42 -195
  68. package/src/reporters/annotations.ts +2 -2
  69. package/src/reporters/json.ts +1 -1
  70. package/src/reporters/reporter.ts +2 -2
  71. package/src/reporters/reporters.ts +1 -1
  72. package/src/reporters/sarif.ts +13 -8
  73. package/src/reporters/text.ts +3 -3
  74. package/src/resolve.ts +11 -11
  75. package/src/run.ts +2 -1
  76. package/src/setup-failure.ts +5 -7
  77. package/src/suppress-file.ts +3 -4
  78. package/src/suppress-inline.ts +2 -2
  79. package/src/suppress.ts +39 -55
  80. package/src/verbs/analyze.ts +16 -4
  81. package/src/verbs/describe.ts +10 -4
  82. package/src/verbs/explain.ts +2 -1
  83. package/src/verbs/print-config.ts +2 -1
  84. package/src/verbs/print-projects.ts +2 -1
  85. package/src/verbs/print-retained.ts +2 -1
  86. package/src/verbs/print-roots.ts +2 -1
  87. package/src/verbs/verb.ts +0 -6
  88. package/src/verbs/version.ts +2 -2
  89. package/dist/src/version.js +0 -7
  90. package/src/version.ts +0 -7
@@ -0,0 +1,796 @@
1
+ // Code generated by scripts/gen-report.ts from the Contract copy under fixtures/ (npm run gen). DO NOT EDIT.
2
+ /** The report and finding schemas, as the validator reads them. */
3
+ export const REPORT_SCHEMAS = {
4
+ "report.schema.json": {
5
+ type: "object",
6
+ additionalProperties: false,
7
+ required: [
8
+ "schema_version",
9
+ "contract_version",
10
+ "analyzer",
11
+ "target",
12
+ "configurations",
13
+ "configurations_not_built",
14
+ "consumers",
15
+ "findings",
16
+ "edge_evaluations",
17
+ "stale_suppressions",
18
+ "declared_gaps",
19
+ "excluded_by_cgo",
20
+ "test_file_rules",
21
+ "type_error_skips",
22
+ "notes",
23
+ "unanswered_questions",
24
+ "conventions_applied",
25
+ "totals",
26
+ ],
27
+ properties: {
28
+ schema_version: { type: "string", pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
29
+ contract_version: { type: "string", pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
30
+ analyzer: {
31
+ type: "object",
32
+ additionalProperties: false,
33
+ required: ["name", "version", "languages", "schema_versions_accepted", "conformance"],
34
+ properties: {
35
+ name: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
36
+ version: {
37
+ type: "string",
38
+ pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$",
39
+ },
40
+ languages: {
41
+ type: "array",
42
+ minItems: 1,
43
+ uniqueItems: true,
44
+ items: { type: "string", enum: ["go", "ts"] },
45
+ },
46
+ schema_versions_accepted: {
47
+ type: "array",
48
+ minItems: 1,
49
+ uniqueItems: true,
50
+ items: { type: "string", pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
51
+ },
52
+ conformance: {
53
+ type: "object",
54
+ additionalProperties: false,
55
+ required: ["corpus_version", "result", "digest"],
56
+ properties: {
57
+ corpus_version: { type: "string", pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
58
+ result: { type: "string", enum: ["pass", "fail"] },
59
+ digest: { type: "string", pattern: "^sha256:[0-9a-f]{64}$" },
60
+ },
61
+ },
62
+ },
63
+ },
64
+ merged_from: {
65
+ type: "array",
66
+ uniqueItems: true,
67
+ items: {
68
+ type: "object",
69
+ additionalProperties: false,
70
+ required: ["name", "version", "digest", "languages", "totals"],
71
+ properties: {
72
+ name: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
73
+ version: {
74
+ type: "string",
75
+ pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$",
76
+ },
77
+ digest: { type: "string", pattern: "^sha256:[0-9a-f]{64}$" },
78
+ languages: { $ref: "#/properties/analyzer/properties/languages" },
79
+ totals: { $ref: "#/properties/totals" },
80
+ },
81
+ },
82
+ },
83
+ target: {
84
+ type: "object",
85
+ additionalProperties: false,
86
+ required: ["kind", "root", "identity"],
87
+ if: { properties: { kind: { const: "mixed" } } },
88
+ then: { required: ["language_kinds"] },
89
+ else: { not: { required: ["language_kinds"] } },
90
+ properties: {
91
+ kind: { type: "string", enum: ["application", "library", "mixed"] },
92
+ language_kinds: {
93
+ type: "object",
94
+ additionalProperties: false,
95
+ minProperties: 2,
96
+ properties: {
97
+ go: { type: "string", enum: ["application", "library"] },
98
+ ts: { type: "string", enum: ["application", "library"] },
99
+ },
100
+ },
101
+ root: {
102
+ type: "string",
103
+ pattern: "^(?:\\.|(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*)$",
104
+ },
105
+ identity: { type: "string", minLength: 1 },
106
+ },
107
+ },
108
+ configurations: {
109
+ type: "array",
110
+ minItems: 1,
111
+ uniqueItems: true,
112
+ items: {
113
+ oneOf: [
114
+ {
115
+ type: "object",
116
+ additionalProperties: false,
117
+ required: ["id", "os", "arch", "tags"],
118
+ properties: {
119
+ id: { type: "string", minLength: 1 },
120
+ os: { type: "string", minLength: 1 },
121
+ arch: { type: "string", minLength: 1 },
122
+ tags: { type: "array", uniqueItems: true, items: { type: "string", minLength: 1 } },
123
+ },
124
+ },
125
+ {
126
+ type: "object",
127
+ additionalProperties: false,
128
+ required: ["id", "project"],
129
+ properties: {
130
+ id: { type: "string", minLength: 1 },
131
+ project: {
132
+ type: "string",
133
+ minLength: 1,
134
+ pattern: "^(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$",
135
+ },
136
+ },
137
+ },
138
+ ],
139
+ },
140
+ },
141
+ configurations_not_built: {
142
+ type: "array",
143
+ uniqueItems: true,
144
+ items: {
145
+ oneOf: [
146
+ {
147
+ type: "object",
148
+ additionalProperties: false,
149
+ required: ["id", "os", "arch", "tags", "error"],
150
+ properties: {
151
+ id: { type: "string", minLength: 1 },
152
+ os: { type: "string", minLength: 1 },
153
+ arch: { type: "string", minLength: 1 },
154
+ tags: { type: "array", uniqueItems: true, items: { type: "string", minLength: 1 } },
155
+ error: { type: "string", minLength: 1, pattern: "^[^\\r\\n]+$" },
156
+ },
157
+ },
158
+ {
159
+ type: "object",
160
+ additionalProperties: false,
161
+ required: ["id", "project", "error"],
162
+ properties: {
163
+ id: { type: "string", minLength: 1 },
164
+ project: {
165
+ type: "string",
166
+ minLength: 1,
167
+ pattern: "^(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$",
168
+ },
169
+ error: { type: "string", minLength: 1, pattern: "^[^\\r\\n]+$" },
170
+ },
171
+ },
172
+ ],
173
+ },
174
+ },
175
+ consumers: {
176
+ type: "object",
177
+ additionalProperties: false,
178
+ required: ["declared", "loaded", "unavailable"],
179
+ properties: {
180
+ declared: { type: "integer", minimum: 0 },
181
+ loaded: {
182
+ type: "array",
183
+ uniqueItems: true,
184
+ items: {
185
+ type: "object",
186
+ additionalProperties: false,
187
+ required: ["id", "role", "path"],
188
+ properties: {
189
+ id: { type: "string", minLength: 1 },
190
+ role: { type: "string", enum: ["consumer"] },
191
+ path: { type: "string", minLength: 1 },
192
+ },
193
+ },
194
+ },
195
+ unavailable: {
196
+ type: "array",
197
+ uniqueItems: true,
198
+ items: {
199
+ type: "object",
200
+ additionalProperties: false,
201
+ required: ["id", "role", "reason"],
202
+ properties: {
203
+ id: { type: "string", minLength: 1 },
204
+ role: { type: "string", enum: ["consumer"] },
205
+ reason: { type: "string", minLength: 1, pattern: "[^ \\t\\r\\n]" },
206
+ },
207
+ },
208
+ },
209
+ },
210
+ },
211
+ findings: {
212
+ type: "array",
213
+ items: { $ref: "finding.schema.json", properties: { retained_by: { maxItems: 0 } } },
214
+ },
215
+ components: {
216
+ type: "array",
217
+ items: {
218
+ type: "object",
219
+ additionalProperties: false,
220
+ required: ["id", "members"],
221
+ properties: {
222
+ id: { type: "string", pattern: "^[a-z][a-z0-9-]*/c-[0-9]+$" },
223
+ members: {
224
+ type: "array",
225
+ uniqueItems: true,
226
+ items: { $ref: "finding.schema.json#/$defs/positioned_symbol" },
227
+ },
228
+ },
229
+ },
230
+ },
231
+ edge_evaluations: {
232
+ type: "array",
233
+ items: {
234
+ type: "object",
235
+ additionalProperties: false,
236
+ required: ["edge", "side", "symbol", "state"],
237
+ properties: {
238
+ edge: { type: "string", pattern: "^[A-Za-z0-9_.-]+(/[A-Za-z0-9_.-]+)*$" },
239
+ side: { type: "string", enum: ["provides", "used_by"] },
240
+ symbol: { type: "string" },
241
+ state: { type: "string", enum: ["live", "dead", "absent"] },
242
+ finding: { $ref: "finding.schema.json" },
243
+ analyzer: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
244
+ },
245
+ if: { properties: { state: { const: "dead" } } },
246
+ then: { required: ["finding"] },
247
+ else: { not: { required: ["finding"] } },
248
+ },
249
+ },
250
+ stale_suppressions: {
251
+ type: "array",
252
+ items: {
253
+ type: "object",
254
+ additionalProperties: false,
255
+ required: ["code", "mechanism", "entry", "position", "symbol", "message"],
256
+ properties: {
257
+ code: { type: "string", const: "DS9003" },
258
+ mechanism: { type: "string", enum: ["inline", "ignore", "baseline"] },
259
+ entry: {
260
+ type: "object",
261
+ additionalProperties: false,
262
+ required: ["code", "path", "reason"],
263
+ properties: {
264
+ code: { type: "string", pattern: "^DS[0-9]{4}$" },
265
+ symbol: { type: "string" },
266
+ path: {
267
+ type: "string",
268
+ pattern: "^(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$",
269
+ },
270
+ reason: { type: "string", minLength: 1, pattern: "[^ \\t\\r\\n]" },
271
+ },
272
+ },
273
+ position: {
274
+ type: "object",
275
+ additionalProperties: false,
276
+ required: ["path", "line", "column"],
277
+ properties: {
278
+ path: {
279
+ type: "string",
280
+ pattern: "^(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$",
281
+ },
282
+ line: { type: "integer", minimum: 1 },
283
+ column: { type: "integer", minimum: 1 },
284
+ },
285
+ },
286
+ symbol: { type: "string" },
287
+ message: { type: "string", minLength: 1, pattern: "[^ \\t\\r\\n]" },
288
+ analyzer: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
289
+ },
290
+ },
291
+ },
292
+ declared_gaps: {
293
+ type: "array",
294
+ items: {
295
+ type: "object",
296
+ additionalProperties: false,
297
+ required: ["fixture", "capability", "reason"],
298
+ properties: {
299
+ fixture: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
300
+ symbol: {
301
+ type: "string",
302
+ pattern: "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$",
303
+ },
304
+ capability: { type: "string", pattern: "^(DS[0-9]{4}|[a-z][a-z0-9]*(-[a-z0-9]+)*)$" },
305
+ reason: { type: "string", minLength: 1, pattern: "[^ \\t\\r\\n]" },
306
+ analyzer: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
307
+ },
308
+ },
309
+ },
310
+ excluded_by_cgo: {
311
+ type: "array",
312
+ uniqueItems: true,
313
+ items: {
314
+ type: "string",
315
+ pattern: "^(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$",
316
+ },
317
+ },
318
+ test_file_rules: {
319
+ type: "array",
320
+ uniqueItems: true,
321
+ items: {
322
+ type: "object",
323
+ additionalProperties: false,
324
+ required: ["rule", "matched"],
325
+ properties: {
326
+ rule: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
327
+ matched: { type: "integer", minimum: 0 },
328
+ },
329
+ },
330
+ },
331
+ type_error_skips: {
332
+ type: "array",
333
+ uniqueItems: true,
334
+ items: {
335
+ type: "object",
336
+ additionalProperties: false,
337
+ required: ["path", "line", "message"],
338
+ properties: {
339
+ path: {
340
+ type: "string",
341
+ pattern: "^(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$",
342
+ },
343
+ line: { type: "integer", minimum: 1 },
344
+ message: { type: "string", minLength: 1, pattern: "^[^\\r\\n]+$" },
345
+ },
346
+ },
347
+ },
348
+ notes: {
349
+ type: "array",
350
+ uniqueItems: true,
351
+ items: {
352
+ type: "object",
353
+ additionalProperties: false,
354
+ required: ["kind", "path", "message"],
355
+ allOf: [
356
+ {
357
+ if: { properties: { kind: { const: "published-package" } } },
358
+ then: { required: ["key"] },
359
+ },
360
+ {
361
+ if: { properties: { kind: { const: "unmapped-entry" } } },
362
+ then: { required: ["key"] },
363
+ },
364
+ {
365
+ if: { properties: { kind: { const: "module-not-loaded" } } },
366
+ then: { not: { required: ["key"] } },
367
+ },
368
+ {
369
+ if: { properties: { kind: { const: "computed-load" } } },
370
+ then: { not: { required: ["key"] } },
371
+ },
372
+ ],
373
+ properties: {
374
+ kind: {
375
+ type: "string",
376
+ enum: ["computed-load", "module-not-loaded", "published-package", "unmapped-entry"],
377
+ },
378
+ path: {
379
+ type: "string",
380
+ pattern: "^(?:\\.|(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*)$",
381
+ },
382
+ key: { type: "string", enum: ["roots.patterns", "ts.entry_files"] },
383
+ message: { type: "string", minLength: 1, pattern: "^[^\\r\\n]+$" },
384
+ },
385
+ },
386
+ },
387
+ unanswered_questions: {
388
+ type: "array",
389
+ uniqueItems: true,
390
+ items: {
391
+ type: "object",
392
+ additionalProperties: false,
393
+ required: ["configuration", "questions", "declarations"],
394
+ properties: {
395
+ configuration: { type: "string", minLength: 1 },
396
+ questions: { type: "integer", minimum: 1 },
397
+ declarations: { type: "integer", minimum: 0 },
398
+ },
399
+ },
400
+ },
401
+ conventions_applied: {
402
+ type: "array",
403
+ uniqueItems: true,
404
+ items: {
405
+ type: "object",
406
+ additionalProperties: false,
407
+ required: ["name", "package", "version", "manifest"],
408
+ properties: {
409
+ name: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
410
+ package: { type: "string", minLength: 1 },
411
+ version: { type: "string", minLength: 1 },
412
+ manifest: {
413
+ type: "string",
414
+ pattern: "^(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$",
415
+ },
416
+ },
417
+ },
418
+ },
419
+ totals: {
420
+ type: "object",
421
+ additionalProperties: false,
422
+ required: [
423
+ "findings",
424
+ "by_severity",
425
+ "deletable_lines",
426
+ "suppressions_in_effect",
427
+ "reasons_recorded",
428
+ "stale_suppressions",
429
+ "pending",
430
+ "omitted",
431
+ "withheld",
432
+ ],
433
+ properties: {
434
+ findings: { type: "integer", minimum: 0 },
435
+ by_severity: {
436
+ type: "object",
437
+ additionalProperties: false,
438
+ required: ["allow", "warn", "deny"],
439
+ properties: {
440
+ allow: { type: "integer", minimum: 0 },
441
+ warn: { type: "integer", minimum: 0 },
442
+ deny: { type: "integer", minimum: 0 },
443
+ },
444
+ },
445
+ deletable_lines: { type: "integer", minimum: 0 },
446
+ suppressions_in_effect: { type: "integer", minimum: 0 },
447
+ reasons_recorded: { type: "integer", minimum: 0 },
448
+ stale_suppressions: { type: "integer", minimum: 0 },
449
+ pending: { type: "integer", minimum: 0 },
450
+ omitted: { type: "integer", minimum: 0 },
451
+ withheld: {
452
+ type: "object",
453
+ additionalProperties: false,
454
+ required: ["certain", "probable", "possible"],
455
+ properties: {
456
+ certain: { type: "integer", minimum: 0, maximum: 0 },
457
+ probable: { type: "integer", minimum: 0 },
458
+ possible: { type: "integer", minimum: 0 },
459
+ },
460
+ },
461
+ },
462
+ },
463
+ },
464
+ },
465
+ "finding.schema.json": {
466
+ type: "object",
467
+ additionalProperties: false,
468
+ required: [
469
+ "code",
470
+ "kind",
471
+ "language",
472
+ "position",
473
+ "symbol",
474
+ "reachability_class",
475
+ "confidence",
476
+ "test_only",
477
+ "generated",
478
+ "component",
479
+ "retained_by",
480
+ "configurations",
481
+ "consumers_loaded",
482
+ "fixability",
483
+ "severity",
484
+ "message",
485
+ "details",
486
+ ],
487
+ properties: {
488
+ code: { type: "string", pattern: "^DS[0-9]{4}$" },
489
+ kind: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
490
+ language: { type: "string", enum: ["go", "ts"] },
491
+ position: { $ref: "#/$defs/position" },
492
+ symbol: {
493
+ type: "object",
494
+ additionalProperties: false,
495
+ required: ["ref", "kind", "name", "size_lines"],
496
+ properties: {
497
+ ref: { $ref: "#/$defs/symbol_reference" },
498
+ kind: {
499
+ type: "string",
500
+ enum: [
501
+ "function",
502
+ "method",
503
+ "type",
504
+ "class",
505
+ "interface",
506
+ "enum",
507
+ "namespace",
508
+ "variable",
509
+ "constant",
510
+ "export-alias",
511
+ "field",
512
+ "class-member",
513
+ "type-member",
514
+ "interface-method",
515
+ "enum-member",
516
+ "satisfaction-assertion",
517
+ "type-parameter",
518
+ "parameter",
519
+ "receiver",
520
+ "result",
521
+ "statement",
522
+ "case",
523
+ "store",
524
+ "file",
525
+ "import",
526
+ "dependency",
527
+ "module-directive",
528
+ "suppression",
529
+ "root",
530
+ "configured-declaration",
531
+ "edge",
532
+ ],
533
+ },
534
+ name: { type: "string", pattern: "^[^\\r\\n]+$" },
535
+ parent: { $ref: "#/$defs/symbol_reference" },
536
+ exported: { type: "boolean" },
537
+ size_lines: { type: "integer", minimum: 1 },
538
+ objectpath: { type: "string", minLength: 1 },
539
+ },
540
+ },
541
+ reachability_class: { type: "string", enum: ["certain", "probable", "possible"] },
542
+ confidence: { type: "string", enum: ["certain", "probable", "possible"] },
543
+ liveness_relation: { type: "string", enum: ["reference-counting", "reachability"] },
544
+ test_only: { type: "boolean" },
545
+ generated: { type: "boolean" },
546
+ component: {
547
+ type: "object",
548
+ additionalProperties: false,
549
+ required: ["id", "root", "symbol_count", "deletable_lines"],
550
+ properties: {
551
+ id: { type: "string", pattern: "^[a-z][a-z0-9-]*/c-[0-9]+$" },
552
+ root: { type: "boolean" },
553
+ symbol_count: { type: "integer", minimum: 1 },
554
+ deletable_lines: { type: "integer", minimum: 0 },
555
+ },
556
+ },
557
+ retained_by: {
558
+ type: "array",
559
+ uniqueItems: true,
560
+ items: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
561
+ },
562
+ configurations: { type: "array", uniqueItems: true, items: { type: "string", minLength: 1 } },
563
+ consumers_loaded: {
564
+ type: "array",
565
+ uniqueItems: true,
566
+ items: { type: "string", minLength: 1 },
567
+ },
568
+ fixability: { type: "string", enum: ["deletable", "narrowable", "manual", "none"] },
569
+ severity: { type: "string", enum: ["allow", "warn", "deny"] },
570
+ message: { type: "string", pattern: "^[^\\r\\n]*[^.\\r\\n]$" },
571
+ analyzer: { type: "string", pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" },
572
+ details: {
573
+ type: "object",
574
+ additionalProperties: false,
575
+ properties: {
576
+ narrower_visibility: { type: "string", enum: ["file", "package", "module"] },
577
+ implementations: {
578
+ type: "array",
579
+ uniqueItems: true,
580
+ items: { $ref: "#/$defs/positioned_symbol" },
581
+ },
582
+ write_positions: {
583
+ type: "array",
584
+ minItems: 1,
585
+ uniqueItems: true,
586
+ items: { $ref: "#/$defs/position" },
587
+ },
588
+ excluded_by: { type: "string", minLength: 1 },
589
+ dependency_class: {
590
+ type: "string",
591
+ enum: ["require", "dependency", "dev-dependency", "peer-dependency"],
592
+ },
593
+ replacement: { type: "string", minLength: 1 },
594
+ mechanism: { type: "string", enum: ["inline", "ignore", "baseline"] },
595
+ entry: {
596
+ type: "object",
597
+ additionalProperties: false,
598
+ required: ["code"],
599
+ properties: {
600
+ code: { type: "string", pattern: "^DS[0-9]{4}$" },
601
+ symbol: { $ref: "#/$defs/symbol_reference" },
602
+ path: { $ref: "#/$defs/relative_path" },
603
+ reason: { type: "string", pattern: "[^ \\t\\r\\n]" },
604
+ },
605
+ },
606
+ overlap: {
607
+ type: "array",
608
+ minItems: 1,
609
+ uniqueItems: true,
610
+ items: { type: "string", minLength: 1 },
611
+ },
612
+ edge: { type: "string", pattern: "^[A-Za-z0-9_.-]+(/[A-Za-z0-9_.-]+)*$" },
613
+ sides: {
614
+ type: "array",
615
+ minItems: 1,
616
+ uniqueItems: true,
617
+ items: {
618
+ type: "object",
619
+ additionalProperties: false,
620
+ required: ["side", "symbol", "state"],
621
+ properties: {
622
+ side: { type: "string", enum: ["provides", "used_by"] },
623
+ symbol: { $ref: "#/$defs/symbol_reference" },
624
+ state: { type: "string", enum: ["live", "dead", "absent"] },
625
+ },
626
+ },
627
+ },
628
+ removes_last_use_of: {
629
+ type: "array",
630
+ minItems: 1,
631
+ uniqueItems: true,
632
+ items: { type: "string", minLength: 1 },
633
+ },
634
+ name_literal: { $ref: "#/$defs/position" },
635
+ },
636
+ },
637
+ },
638
+ allOf: [
639
+ {
640
+ if: { required: ["code"], properties: { code: { enum: ["DS1501", "DS1502", "DS1503"] } } },
641
+ then: { properties: { details: { required: ["narrower_visibility"] } } },
642
+ else: {
643
+ properties: { details: { not: { anyOf: [{ required: ["narrower_visibility"] }] } } },
644
+ },
645
+ },
646
+ {
647
+ if: { required: ["code"], properties: { code: { enum: ["DS1201", "DS1202", "DS1203"] } } },
648
+ then: { properties: { details: { required: ["implementations"] } } },
649
+ else: { properties: { details: { not: { anyOf: [{ required: ["implementations"] }] } } } },
650
+ },
651
+ {
652
+ if: { required: ["code"], properties: { code: { enum: ["DS1301", "DS1404"] } } },
653
+ then: { properties: { details: { required: ["write_positions"] } } },
654
+ else: { properties: { details: { not: { anyOf: [{ required: ["write_positions"] }] } } } },
655
+ },
656
+ {
657
+ if: { required: ["code"], properties: { code: { const: "DS1601" } } },
658
+ then: {
659
+ allOf: [
660
+ {
661
+ if: { required: ["language"], properties: { language: { enum: ["go"] } } },
662
+ then: { properties: { details: { required: ["excluded_by"] } } },
663
+ else: {
664
+ properties: { details: { not: { anyOf: [{ required: ["excluded_by"] }] } } },
665
+ },
666
+ },
667
+ ],
668
+ },
669
+ else: { properties: { details: { not: { anyOf: [{ required: ["excluded_by"] }] } } } },
670
+ },
671
+ {
672
+ if: { required: ["code"], properties: { code: { const: "DS1701" } } },
673
+ then: { properties: { details: { required: ["dependency_class"] } } },
674
+ else: { properties: { details: { not: { anyOf: [{ required: ["dependency_class"] }] } } } },
675
+ },
676
+ {
677
+ if: { required: ["code"], properties: { code: { const: "DS1702" } } },
678
+ then: { properties: { details: { required: ["replacement"] } } },
679
+ else: { properties: { details: { not: { anyOf: [{ required: ["replacement"] }] } } } },
680
+ },
681
+ {
682
+ if: { required: ["code"], properties: { code: { enum: ["DS9001", "DS9002", "DS9003"] } } },
683
+ then: { properties: { details: { required: ["mechanism", "entry"] } } },
684
+ else: {
685
+ properties: {
686
+ details: { not: { anyOf: [{ required: ["mechanism"] }, { required: ["entry"] }] } },
687
+ },
688
+ },
689
+ },
690
+ {
691
+ if: {
692
+ required: ["code"],
693
+ properties: {
694
+ code: { enum: ["DS1401", "DS1402", "DS1403", "DS1404", "DS1405", "DS1406"] },
695
+ },
696
+ },
697
+ then: { properties: { details: { required: ["overlap"] } } },
698
+ else: { properties: { details: { not: { anyOf: [{ required: ["overlap"] }] } } } },
699
+ },
700
+ {
701
+ if: { required: ["code"], properties: { code: { const: "DS9005" } } },
702
+ then: { properties: { details: { required: ["edge", "sides"] } } },
703
+ else: {
704
+ properties: {
705
+ details: { not: { anyOf: [{ required: ["edge"] }, { required: ["sides"] }] } },
706
+ },
707
+ },
708
+ },
709
+ {
710
+ if: {
711
+ required: ["code"],
712
+ properties: {
713
+ code: { enum: ["DS1001", "DS1002", "DS1101", "DS1102", "DS1104", "DS1501", "DS1502"] },
714
+ },
715
+ },
716
+ then: {
717
+ if: { required: ["details"], properties: { details: { required: ["name_literal"] } } },
718
+ then: { properties: { reachability_class: { const: "possible" } } },
719
+ },
720
+ else: { properties: { details: { not: { anyOf: [{ required: ["name_literal"] }] } } } },
721
+ },
722
+ {
723
+ if: {
724
+ anyOf: [
725
+ {
726
+ required: ["symbol"],
727
+ properties: {
728
+ symbol: {
729
+ required: ["kind"],
730
+ properties: {
731
+ kind: {
732
+ enum: [
733
+ "case",
734
+ "configured-declaration",
735
+ "dependency",
736
+ "edge",
737
+ "file",
738
+ "import",
739
+ "module-directive",
740
+ "parameter",
741
+ "receiver",
742
+ "result",
743
+ "root",
744
+ "statement",
745
+ "store",
746
+ "suppression",
747
+ ],
748
+ },
749
+ },
750
+ },
751
+ },
752
+ },
753
+ {
754
+ required: ["code"],
755
+ properties: { code: { enum: ["DS1203", "DS1301", "DS1501", "DS1502", "DS1503"] } },
756
+ },
757
+ ],
758
+ },
759
+ then: { not: { required: ["liveness_relation"] } },
760
+ else: { required: ["liveness_relation"] },
761
+ },
762
+ {
763
+ if: { required: ["fixability"], properties: { fixability: { const: "deletable" } } },
764
+ else: { properties: { details: { not: { required: ["removes_last_use_of"] } } } },
765
+ },
766
+ ],
767
+ $defs: {
768
+ position: {
769
+ type: "object",
770
+ additionalProperties: false,
771
+ required: ["path", "line", "column", "end_line"],
772
+ properties: {
773
+ path: { $ref: "#/$defs/relative_path" },
774
+ line: { type: "integer", minimum: 1 },
775
+ column: { type: "integer", minimum: 1 },
776
+ end_line: { type: "integer", minimum: 1 },
777
+ },
778
+ },
779
+ relative_path: {
780
+ type: "string",
781
+ pattern: "^(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+)(?:/(?:[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.[^/.\\x00-\\x1f\\x7f][^/\\x00-\\x1f\\x7f]*|\\.\\.[^/\\x00-\\x1f\\x7f]+))*$",
782
+ },
783
+ symbol_reference: { type: "string", minLength: 1 },
784
+ positioned_symbol: {
785
+ type: "object",
786
+ additionalProperties: false,
787
+ required: ["ref", "name", "position"],
788
+ properties: {
789
+ ref: { $ref: "#/$defs/symbol_reference" },
790
+ name: { type: "string", pattern: "^[^\\r\\n]+$" },
791
+ position: { $ref: "#/$defs/position" },
792
+ },
793
+ },
794
+ },
795
+ },
796
+ };