@cplieger/deadset-ts 3.10.0 → 3.12.0
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.
- package/README.md +13 -13
- package/dist/src/analysis.js +56 -16
- package/dist/src/config.js +6 -0
- package/dist/src/conformance-record.js +2 -12
- package/dist/src/consumers.js +49 -0
- package/dist/src/discover.js +59 -23
- package/dist/src/findings/completion.js +49 -17
- package/dist/src/findings/non-code-artifacts.js +9 -2
- package/dist/src/findings/reads-and-writes.js +3 -1
- package/dist/src/findings-pass.js +3 -5
- package/dist/src/graph.js +8 -5
- package/dist/src/matrix.js +14 -3
- package/dist/src/references.js +21 -9
- package/dist/src/report.js +4 -1
- package/dist/src/reporters/annotations.js +36 -0
- package/dist/src/reporters/fingerprint.js +61 -0
- package/dist/src/reporters/reporter.js +7 -1
- package/dist/src/reporters/reporters.js +18 -0
- package/dist/src/reporters/rules.js +178 -0
- package/dist/src/reporters/sarif.js +235 -0
- package/dist/src/reporters/sha256.js +101 -0
- package/dist/src/reporters/template.js +877 -0
- package/dist/src/run.js +4 -10
- package/dist/src/session.js +15 -0
- package/dist/src/sweep.js +11 -0
- package/dist/src/verbs/analyze.js +48 -16
- package/dist/src/verbs/explain.js +317 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/analysis.ts +123 -29
- package/src/config.ts +8 -0
- package/src/conformance-record.ts +2 -14
- package/src/consumers.ts +86 -0
- package/src/discover.ts +67 -23
- package/src/findings/completion.ts +56 -20
- package/src/findings/non-code-artifacts.ts +9 -2
- package/src/findings/reads-and-writes.ts +3 -1
- package/src/findings-pass.ts +5 -7
- package/src/graph.ts +14 -5
- package/src/matrix.ts +14 -5
- package/src/references.ts +48 -9
- package/src/report.ts +17 -2
- package/src/reporters/annotations.ts +67 -0
- package/src/reporters/fingerprint.ts +69 -0
- package/src/reporters/json.ts +2 -2
- package/src/reporters/reporter.ts +21 -2
- package/src/reporters/reporters.ts +18 -1
- package/src/reporters/rules.ts +195 -0
- package/src/reporters/sarif.ts +287 -0
- package/src/reporters/sha256.ts +120 -0
- package/src/reporters/template.ts +989 -0
- package/src/reporters/text.ts +2 -3
- package/src/run.ts +5 -11
- package/src/session.ts +19 -0
- package/src/sweep.ts +13 -1
- package/src/verbs/analyze.ts +60 -19
- package/src/verbs/explain.ts +380 -0
package/dist/src/matrix.js
CHANGED
|
@@ -14,10 +14,21 @@ function compare(a, b) {
|
|
|
14
14
|
}
|
|
15
15
|
return a < b ? -1 : 1;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* What makes one reference one reference, whichever configuration made it. A consumer's
|
|
19
|
+
* position is rendered against its own root, so the consumer is part of what it names.
|
|
20
|
+
*/
|
|
21
|
+
export function referenceKey(reference) {
|
|
19
22
|
const { path, line, column } = reference.position;
|
|
20
|
-
return [
|
|
23
|
+
return [
|
|
24
|
+
reference.consumer ?? "",
|
|
25
|
+
reference.from,
|
|
26
|
+
reference.to,
|
|
27
|
+
path,
|
|
28
|
+
String(line),
|
|
29
|
+
String(column),
|
|
30
|
+
reference.use,
|
|
31
|
+
].join("\u0000");
|
|
21
32
|
}
|
|
22
33
|
/**
|
|
23
34
|
* Indexes what the passes answered for each configuration of one run, in the run's order.
|
package/dist/src/references.js
CHANGED
|
@@ -3,6 +3,7 @@ import { aliasChains } from "./alias-chain.js";
|
|
|
3
3
|
import { destructuring, propertyReadsOf } from "./destructuring.js";
|
|
4
4
|
import { globExpression } from "./glob.js";
|
|
5
5
|
import { nodeKey } from "./inventory.js";
|
|
6
|
+
import { relativePath } from "./paths.js";
|
|
6
7
|
import { byPosition, renderPosition } from "./position.js";
|
|
7
8
|
/**
|
|
8
9
|
* The batch cap a run takes when the configuration names none. It bounds the size of
|
|
@@ -306,7 +307,9 @@ function compare(a, b) {
|
|
|
306
307
|
*
|
|
307
308
|
* `held` is the inventory of the same project, whose declaration map is what a resolved
|
|
308
309
|
* symbol is looked up in; `targetRoot` is the absolute path every position is rendered
|
|
309
|
-
* against, which is the root the inventory was read against.
|
|
310
|
+
* against, which is the root the inventory was read against. A pass over a consumer
|
|
311
|
+
* walks the consumer's files instead and renders against its root, as
|
|
312
|
+
* {@link ReferenceOptions.consumer} states.
|
|
310
313
|
*
|
|
311
314
|
* The order is by the referencing position, then by the declaration named, the
|
|
312
315
|
* declaration referencing it and the use. That is a total order because one name
|
|
@@ -326,7 +329,14 @@ export function references(project, held, targetRoot, options) {
|
|
|
326
329
|
let fileBatches = 0;
|
|
327
330
|
let residueFallbacks = 0;
|
|
328
331
|
let shorthandLookups = 0;
|
|
329
|
-
const
|
|
332
|
+
const consumer = options.consumer;
|
|
333
|
+
const root = consumer?.root ?? targetRoot;
|
|
334
|
+
const files = consumer === undefined
|
|
335
|
+
? project.ownSourceFiles()
|
|
336
|
+
: project
|
|
337
|
+
.ownSourceFiles()
|
|
338
|
+
.filter((file) => relativePath(consumer.root, file.fileName) !== undefined &&
|
|
339
|
+
relativePath(targetRoot, file.fileName) === undefined);
|
|
330
340
|
const fileIds = new Set(held.symbols.filter((symbol) => symbol.kind === "file").map((symbol) => symbol.id));
|
|
331
341
|
/** The identifier of the declaration one node of this program is, where it is one. */
|
|
332
342
|
const declaredAt = (node) => declarations.get(nodeKey(node.getSourceFile(), node));
|
|
@@ -352,7 +362,7 @@ export function references(project, held, targetRoot, options) {
|
|
|
352
362
|
return project.resolvedSymbolAt(project.handle(site.node));
|
|
353
363
|
};
|
|
354
364
|
for (const file of files) {
|
|
355
|
-
const path = renderPosition(file,
|
|
365
|
+
const path = renderPosition(file, root, 0).path;
|
|
356
366
|
const test = patterns.some((pattern) => pattern.test(path));
|
|
357
367
|
if (test) {
|
|
358
368
|
tests.push(path);
|
|
@@ -365,7 +375,7 @@ export function references(project, held, targetRoot, options) {
|
|
|
365
375
|
found.push({
|
|
366
376
|
from: declaration,
|
|
367
377
|
to: declaration,
|
|
368
|
-
position: renderPosition(file,
|
|
378
|
+
position: renderPosition(file, root, decorator.getStart()),
|
|
369
379
|
use: "decorator",
|
|
370
380
|
resolution: "syntax",
|
|
371
381
|
test,
|
|
@@ -401,7 +411,7 @@ export function references(project, held, targetRoot, options) {
|
|
|
401
411
|
if (symbol === undefined) {
|
|
402
412
|
continue;
|
|
403
413
|
}
|
|
404
|
-
const position = renderPosition(file,
|
|
414
|
+
const position = renderPosition(file, root, link.at.getStart());
|
|
405
415
|
for (const id of carriedBy(link, symbol)) {
|
|
406
416
|
found.push({
|
|
407
417
|
from: link.from,
|
|
@@ -418,7 +428,7 @@ export function references(project, held, targetRoot, options) {
|
|
|
418
428
|
if (module === undefined) {
|
|
419
429
|
continue;
|
|
420
430
|
}
|
|
421
|
-
const position = renderPosition(file,
|
|
431
|
+
const position = renderPosition(file, root, evaluation.node.getStart());
|
|
422
432
|
for (const id of chains.declarationsOf(module)) {
|
|
423
433
|
if (fileIds.has(id)) {
|
|
424
434
|
found.push({
|
|
@@ -439,7 +449,7 @@ export function references(project, held, targetRoot, options) {
|
|
|
439
449
|
if (symbol === undefined || read === undefined) {
|
|
440
450
|
return;
|
|
441
451
|
}
|
|
442
|
-
const position = renderPosition(file,
|
|
452
|
+
const position = renderPosition(file, root, read.key.getStart());
|
|
443
453
|
for (const target of chains.chainOf(symbol)) {
|
|
444
454
|
found.push({
|
|
445
455
|
from: read.from,
|
|
@@ -461,7 +471,7 @@ export function references(project, held, targetRoot, options) {
|
|
|
461
471
|
if (symbol === undefined) {
|
|
462
472
|
continue;
|
|
463
473
|
}
|
|
464
|
-
const position = renderPosition(file,
|
|
474
|
+
const position = renderPosition(file, root, site.node.getStart());
|
|
465
475
|
// A re-export something imports is used and so is the declaration behind it, so
|
|
466
476
|
// the use names every link of the chain its name stands at the head of.
|
|
467
477
|
for (const target of chains.chainOf(symbol)) {
|
|
@@ -482,7 +492,9 @@ export function references(project, held, targetRoot, options) {
|
|
|
482
492
|
compare(a.use, b.use));
|
|
483
493
|
return {
|
|
484
494
|
configFile: project.configFile,
|
|
485
|
-
references:
|
|
495
|
+
references: consumer === undefined
|
|
496
|
+
? found
|
|
497
|
+
: found.map((reference) => ({ ...reference, consumer: consumer.id })),
|
|
486
498
|
testFilePaths: tests.sort(compare),
|
|
487
499
|
cost: {
|
|
488
500
|
batched,
|
package/dist/src/report.js
CHANGED
|
@@ -188,6 +188,9 @@ export function buildReport(input) {
|
|
|
188
188
|
const unavailable = [...new Map(input.unavailable.map((one) => [one.id, one])).values()]
|
|
189
189
|
.sort((a, b) => compare(a.id, b.id))
|
|
190
190
|
.map((one) => ({ id: one.id, role: "consumer", reason: one.reason }));
|
|
191
|
+
const loaded = [...input.loaded]
|
|
192
|
+
.sort((a, b) => compare(a.id, b.id) || compare(a.path, b.path))
|
|
193
|
+
.map((one) => ({ id: one.id, role: "consumer", path: one.path }));
|
|
191
194
|
return {
|
|
192
195
|
schema_version: SCHEMA_VERSION,
|
|
193
196
|
contract_version: input.contractVersion,
|
|
@@ -207,7 +210,7 @@ export function buildReport(input) {
|
|
|
207
210
|
.sort((a, b) => compare(a.id, b.id))
|
|
208
211
|
.map((one) => ({ id: one.id, project: one.project })),
|
|
209
212
|
configurations_not_built: [],
|
|
210
|
-
consumers: { declared: unavailable.length, loaded
|
|
213
|
+
consumers: { declared: loaded.length + unavailable.length, loaded, unavailable },
|
|
211
214
|
findings,
|
|
212
215
|
edge_evaluations: input.result.edgeEvaluations.map(wireEvaluation).sort(byEdge),
|
|
213
216
|
stale_suppressions: input.result.staleSuppressions.map(wireStale).sort(canonicalStale),
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { fails } from "../config.js";
|
|
2
|
+
import { KINDS } from "../kinds.js";
|
|
3
|
+
/** The escapes a workflow command's message needs, so a line break does not end the command. */
|
|
4
|
+
const DATA_ESCAPES = { "%": "%25", "\r": "%0D", "\n": "%0A" };
|
|
5
|
+
/** The escapes a property value needs: a message's, and the property list's two separators. */
|
|
6
|
+
const PROPERTY_ESCAPES = {
|
|
7
|
+
...DATA_ESCAPES,
|
|
8
|
+
":": "%3A",
|
|
9
|
+
",": "%2C",
|
|
10
|
+
};
|
|
11
|
+
function escapeData(value) {
|
|
12
|
+
return value.replace(/[%\r\n]/gu, (char) => DATA_ESCAPES[char] ?? char);
|
|
13
|
+
}
|
|
14
|
+
function escapeProperty(value) {
|
|
15
|
+
return value.replace(/[%\r\n:,]/gu, (char) => PROPERTY_ESCAPES[char] ?? char);
|
|
16
|
+
}
|
|
17
|
+
/** The name of the kind a code names, and the code itself where no live kind carries it. */
|
|
18
|
+
function kindName(code) {
|
|
19
|
+
return KINDS.get(code)?.name ?? code;
|
|
20
|
+
}
|
|
21
|
+
function command(level, at, endLine, title, message) {
|
|
22
|
+
return `::${level} file=${escapeProperty(at.path)},line=${String(at.line)},col=${String(at.column)},endLine=${String(endLine)},title=${escapeProperty(title)}::${escapeData(message)}`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One workflow annotation per finding, then one per stale suppression, each naming its
|
|
26
|
+
* file, line, column and last line, titled by its code and kind. A finding at or above the
|
|
27
|
+
* failing severity is an error and one below it a warning; a stale suppression is an error,
|
|
28
|
+
* because its kind is fixed on at the failing severity.
|
|
29
|
+
*/
|
|
30
|
+
export function annotations(report, options) {
|
|
31
|
+
const lines = report.findings.map((found) => command(fails(found.severity, options.failOn) ? "error" : "warning", found.position, found.position.end_line, `${found.code} ${found.kind}`, found.message));
|
|
32
|
+
for (const stale of report.stale_suppressions) {
|
|
33
|
+
lines.push(command("error", stale.position, stale.position.line, `${stale.code} ${kindName(stale.code)}`, stale.message));
|
|
34
|
+
}
|
|
35
|
+
return lines.map((line) => `${line}\n`).join("");
|
|
36
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { sha256Hex } from "./sha256.js";
|
|
2
|
+
/** The unit appended after the last unit of a file. */
|
|
3
|
+
const SENTINEL = 0xffffn;
|
|
4
|
+
/** The number of significant units one line's hash covers. */
|
|
5
|
+
const WINDOW = 100;
|
|
6
|
+
const FACTOR = 37n;
|
|
7
|
+
/** Arithmetic is unsigned 64-bit with wraparound. */
|
|
8
|
+
const MASK = (1n << 64n) - 1n;
|
|
9
|
+
const SPACE = 0x20;
|
|
10
|
+
const TAB = 0x09;
|
|
11
|
+
const CR = 0x0d;
|
|
12
|
+
const LF = 0x0a;
|
|
13
|
+
/**
|
|
14
|
+
* The units of one file the line fingerprint counts: every UTF-16 code unit but a space or
|
|
15
|
+
* a tab, a carriage return read as a line feed and the line feed following it dropped, then
|
|
16
|
+
* the sentinel.
|
|
17
|
+
*/
|
|
18
|
+
function significantUnits(text) {
|
|
19
|
+
const kept = [];
|
|
20
|
+
let afterCR = false;
|
|
21
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
22
|
+
const unit = text.charCodeAt(i);
|
|
23
|
+
if (unit === SPACE || unit === TAB || (afterCR && unit === LF)) {
|
|
24
|
+
afterCR = false;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
afterCR = unit === CR;
|
|
28
|
+
kept.push(BigInt(afterCR ? LF : unit));
|
|
29
|
+
}
|
|
30
|
+
kept.push(SENTINEL);
|
|
31
|
+
return kept;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The line fingerprint of every line of one file, indexed from zero. The procedure is the one
|
|
35
|
+
* a code-scanning service computes for a result that carries none, followed exactly, because
|
|
36
|
+
* a value that differs from the service's opens a second alert for one finding.
|
|
37
|
+
*/
|
|
38
|
+
export function lineHashes(text) {
|
|
39
|
+
const units = significantUnits(text);
|
|
40
|
+
const starts = [0];
|
|
41
|
+
for (let i = 0; i < units.length - 1; i += 1) {
|
|
42
|
+
if (units[i] === BigInt(LF)) {
|
|
43
|
+
starts.push(i + 1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const seen = new Map();
|
|
47
|
+
return starts.map((start) => {
|
|
48
|
+
let hash = 0n;
|
|
49
|
+
for (let i = start; i < start + WINDOW; i += 1) {
|
|
50
|
+
hash = (hash * FACTOR + (units[i] ?? 0n)) & MASK;
|
|
51
|
+
}
|
|
52
|
+
const rendered = hash.toString(16);
|
|
53
|
+
const count = (seen.get(rendered) ?? 0) + 1;
|
|
54
|
+
seen.set(rendered, count);
|
|
55
|
+
return `${rendered}:${String(count)}`;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** The key a baseline joins on, which a line move leaves unchanged. */
|
|
59
|
+
export function symbolFingerprint(code, ref) {
|
|
60
|
+
return sha256Hex(`${code}\n${ref}`);
|
|
61
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { annotations } from "./annotations.js";
|
|
1
2
|
import { json } from "./json.js";
|
|
3
|
+
import { RenderError } from "./reporter.js";
|
|
4
|
+
import { sarif } from "./sarif.js";
|
|
5
|
+
import { renderTemplate } from "./template.js";
|
|
2
6
|
import { text } from "./text.js";
|
|
3
7
|
/**
|
|
4
8
|
* Every format this analyzer renders, each by its reporter and its file suffix. A format
|
|
@@ -7,4 +11,18 @@ import { text } from "./text.js";
|
|
|
7
11
|
export const RENDERINGS = new Map([
|
|
8
12
|
["text", { render: text, suffix: ".txt" }],
|
|
9
13
|
["json", { render: json, suffix: ".json" }],
|
|
14
|
+
["github", { render: annotations, suffix: ".annotations" }],
|
|
15
|
+
["sarif", { render: sarif, suffix: ".sarif" }],
|
|
16
|
+
[
|
|
17
|
+
"template",
|
|
18
|
+
{
|
|
19
|
+
render: (report, options) => {
|
|
20
|
+
if (options.template === undefined) {
|
|
21
|
+
throw new RenderError("the template rendering renders a template, and none was named");
|
|
22
|
+
}
|
|
23
|
+
return renderTemplate(options.template, report);
|
|
24
|
+
},
|
|
25
|
+
suffix: ".tmpl",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
10
28
|
]);
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text of every live issue kind this analyzer's language carries, which a SARIF rule
|
|
3
|
+
* describes the kind with, written out rather than read at run time. A test compares this
|
|
4
|
+
* table against the Contract release the analyzer is written against.
|
|
5
|
+
*/
|
|
6
|
+
/** Every live issue kind whose languages include this analyzer's, by code, in ascending order. */
|
|
7
|
+
export const RULE_TEXTS = new Map([
|
|
8
|
+
[
|
|
9
|
+
"DS1001",
|
|
10
|
+
{
|
|
11
|
+
rule: "An exported symbol with no reference in the target and no reference from any loaded consumer. A symbol referenced only from its own declaration site counts as unreferenced.",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"DS1002",
|
|
16
|
+
{
|
|
17
|
+
rule: "An unexported symbol with no reference in the target. A symbol referenced only from its own declaration site counts as unreferenced.",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"DS1003",
|
|
22
|
+
{
|
|
23
|
+
rule: "A struct field, class member or type member with no reference, a private member included. A member referenced only from its own declaration site counts as unreferenced.",
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"DS1004",
|
|
28
|
+
{
|
|
29
|
+
rule: "A symbol with zero production references and at least one test reference: an unused-exported or unused-unexported candidate whose test reference count is not zero, reported once under this code. A reference from a consumer's test files is a test reference unless the configuration counts consumer tests as production.",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
"DS1005",
|
|
34
|
+
{
|
|
35
|
+
rule: "A test symbol whose set of referenced target symbols is non-empty and every member of that set is reported dead. A test that references at least one live target symbol is never reported, no notion of a test's subject and no name matching enters the rule, and the message states the rule. The test joins the dead component of the symbols it references.",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"DS1006",
|
|
40
|
+
{
|
|
41
|
+
rule: "A symbol carrying a deprecation marker and no production reference: an unused-exported, unused-unexported or unused-member candidate whose symbol is deprecated, reported once under this code. Go identifies the marker by the convention the standard tools recognize, TypeScript by the documentation tag its tools recognize.",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
"DS1101",
|
|
46
|
+
{
|
|
47
|
+
rule: "An exported symbol whose every reference is inside the symbol's own package or module, reported as a candidate for unexporting. The subject is a package-level declaration or a method, and three subjects are excluded: an interface method, whose exportedness is the contract of the interface that declares it; a struct field, which an encoder reads by name; and a method that satisfies an interface some symbol uses as a type, which cannot be unexported without its type ceasing to satisfy that interface. The finding names the narrower visibility the references support. A declared cross-language edge counts as an out-of-package reference; where the edge's other side is unknown to the analyzer the finding is emitted pending.",
|
|
48
|
+
precondition: "Closed world only. Reported always for a main package and an internal/ directory tree, and for a published package only when the configuration declares the consumer set complete and every declared consumer loads. A library with no consumer loaded and no complete consumer set declared gets this finding on its internal/ tree and its main packages and never on its published API.",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"DS1103",
|
|
53
|
+
{
|
|
54
|
+
rule: "An unused exported symbol in a package or file no external code can import: an unused-exported candidate whose enclosing package or file is unimportable from outside, reported once under this code at the certain class, because unimportability is a property of the package graph rather than of the consumer set.",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
"DS1104",
|
|
59
|
+
{
|
|
60
|
+
rule: "An exported declaration used only inside its own file, reported as a candidate for removing the export keyword. The finding names the narrower visibility the references support.",
|
|
61
|
+
precondition: "Closed world only. Reported in a file that is not an entry file and that either belongs to a project whose consumer set the configuration declares complete or is reached by no manifest export. A declared cross-language edge counts as a reference from outside the file; where the edge's other side is unknown to the analyzer the finding is emitted pending.",
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
"DS1201",
|
|
66
|
+
{
|
|
67
|
+
rule: "An interface no symbol uses as a type, counting uses from every loaded module. The finding names the concrete implementations and their positions, and the interface's members join its dead component rather than being reported as independent unused declarations.",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
"DS1203",
|
|
72
|
+
{
|
|
73
|
+
rule: "An interface method that no call site invokes or selects through the interface, whatever the number of implementations. The finding names the concrete implementations and their positions.",
|
|
74
|
+
precondition: "Exempt: every method of an interface that declares an unexported method, the sum-type shape whose method set exists to restrict the implementors; and every marker method, an interface method whose every implementation carries an empty body.",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"DS1301",
|
|
79
|
+
{
|
|
80
|
+
rule: "A package-level or module-level variable, struct field, class member or collection that production code writes and never reads. In production mode a read from a test file counts as no read. A comparison of struct values reads every field of the type: in Go, a value of a struct type used as an operand of `==` or `!=`, as a map key, or as a `switch` tag or `case` expression is a read of every field of that type, transitively through the fields of every struct type it holds, recorded at the comparison, because equality reads every field and a field that decides equality carries information. In TypeScript a comparison of two object references reads no member, because `===` compares identity and never a member. The finding names each write position, so the deletion set is visible.",
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
"DS1302",
|
|
85
|
+
{
|
|
86
|
+
rule: "An enumerated member that no symbol names, at the reachability class derived for the member and with no confidence ceiling below it. Every member of a type that carries a string, text or binary conversion method, or that a conversion from an integer or a wire value produces, is retained by the enum-group exemption first, so a member reached only by value is never a candidate.",
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"DS1303",
|
|
91
|
+
{
|
|
92
|
+
rule: "A type parameter of a function or method that no part of the declaration's signature and no part of the declaration's body names, at the certain class. The deletion is local to the declaration and the explicit instantiations the reference set already lists.",
|
|
93
|
+
precondition: "Function and method type parameters only. A type parameter of a type declaration is never reported, because a phantom type parameter such as `type ID[T any] int` makes two instantiations distinct types while naming the parameter nowhere, so deleting it changes the program.",
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
"DS1501",
|
|
98
|
+
{
|
|
99
|
+
rule: "A source file no configuration in the build matrix builds. On the Go side the finding names the build constraint that excluded the file. A file whose build constraint is the ignore tag is never reported: the toolchain applies no build constraint to a file named on its own command line, so that tag is the toolchain's convention for a file built by hand. A file any other custom tag excludes is reported under a matrix the configuration declares complete, because completeness is the maintainer's assertion that the listed configurations are every one the target builds, and a configuration the maintainer builds by hand belongs in that list.",
|
|
100
|
+
precondition: 'Reported only when the configuration declares the build matrix complete, and never for a file the toolchain ignored solely because it imports "C" under a build with cgo disabled; such a file is recorded as excluded by cgo rather than as never built.',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
"DS1502",
|
|
105
|
+
{
|
|
106
|
+
rule: "A source file that no import reaches, that no root names, and in which no declared cross-language edge names a declaration. An edge's side names a declaration as a root names one, so a file holding a declaration an edge names is evaluated with the edge rather than reported: whether that declaration is dead is the edge evaluation's to say, and the merge resolves it against the paired side.",
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
"DS1601",
|
|
111
|
+
{
|
|
112
|
+
rule: "A directly declared dependency that no import in the target needs. On the Go side, a direct require whose module provides no package any target package or test variant imports. On the TypeScript side, a manifest dependency, development dependency or peer dependency the project's import closure does not need. A deletion finding whose fix would remove the last use of a dependency names that dependency.",
|
|
113
|
+
precondition: "On the Go side the rule is the semantics of `go mod tidy -diff` exactly: a requirement marked indirect is never reported, because it exists to pin a transitive version and removing it changes the build list.",
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
"DS1701",
|
|
118
|
+
{
|
|
119
|
+
rule: "A suppression that carries no reason, in any of the three documents: an inline directive, an ignore-file entry or a baseline row. For the ignore file and the baseline, an entry or a row whose reason field is absent, empty or whitespace only is refused and reported rather than matched.",
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
[
|
|
123
|
+
"DS1702",
|
|
124
|
+
{
|
|
125
|
+
rule: "An ignore-file entry or a baseline row that names a symbol and no file path. The entry is reported rather than matched, so a bare name cannot mask a match anywhere else in the project; the inline directive is scoped by its position and cannot be unscoped.",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
"DS1703",
|
|
130
|
+
{
|
|
131
|
+
rule: "A suppression that matches no current finding, at either mechanism and in the baseline alike. The run exits with the findings code when at least one is reported. The kind is fixed on at deny: no flag, no severity setting and no per-mechanism exception reduces it below a finding, and a configuration naming this code under a severity key is an unimplemented key.",
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
"DS1704",
|
|
136
|
+
{
|
|
137
|
+
rule: "A configured root that matches no symbol, or a configured root pattern that matches no symbol. A root set nobody checks silently changes every result, so a stale one is a finding. The kind is fixed on at deny: no flag, no severity setting and no exception reduces it below a finding, and a configuration naming this code under a severity key is an unimplemented key.",
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
"DS1705",
|
|
142
|
+
{
|
|
143
|
+
rule: "A declared cross-language edge with a side that at least one analyzer evaluated and every evaluation of that side reports absent, so no analyzer that ran enumerates that side's symbol. Emitted by the merge, once per edge, never by an analyzer, so a stale edge is visible rather than silently inert. A dead side paired with an absent side drops its pending finding, and the edge is the reported defect: a misspelled reference must not turn a live pairing into a deletion.",
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
"DS1801",
|
|
148
|
+
{
|
|
149
|
+
rule: "A parameter with no reference inside its function body, on a function whose signature is free to change.",
|
|
150
|
+
precondition: "The signature must be free, defined as follows: the function is not a method retained by interface satisfaction, is not used as a value, is not a go:linkname or cgo target, and is not a stub whose body is empty or only panics. A parameter its body never names is dead whatever the callers, so a published declaration of a library is reported too, with the fixability the vocabulary gives the kind: the signature change is a breaking change.",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
"DS1803",
|
|
155
|
+
{
|
|
156
|
+
rule: "A result value that no call site of the function uses, on a function whose signature is free to change.",
|
|
157
|
+
precondition: "The same free-signature rule as unused-parameter, plus a closed-world condition: every call site of the function must be in the loaded graph, because an unknown caller may consume the result, so the kind reports only for a function whose callers are all visible.",
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
[
|
|
161
|
+
"DS1805",
|
|
162
|
+
{
|
|
163
|
+
rule: "A statement that control flow cannot reach, at the precision the language's compiler applies to the same construct.",
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
"DS1807",
|
|
168
|
+
{
|
|
169
|
+
rule: "A write to a local variable with no read before the next write to it or the end of its scope, computed on the same read-and-write classification the write-only-symbol kind uses. The finding names the write position.",
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
[
|
|
173
|
+
"DS1809",
|
|
174
|
+
{
|
|
175
|
+
rule: "A switch case whose type or value an earlier case in the same switch already covers.",
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
]);
|