@cplieger/deadset-ts 3.9.1 → 3.11.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.
Files changed (41) hide show
  1. package/README.md +13 -13
  2. package/dist/src/analysis.js +5 -3
  3. package/dist/src/config.js +6 -0
  4. package/dist/src/conformance-record.js +26 -0
  5. package/dist/src/conformance.js +8 -20
  6. package/dist/src/findings-pass.js +3 -5
  7. package/dist/src/report.js +14 -1
  8. package/dist/src/reporters/annotations.js +36 -0
  9. package/dist/src/reporters/fingerprint.js +61 -0
  10. package/dist/src/reporters/reporter.js +7 -1
  11. package/dist/src/reporters/reporters.js +18 -0
  12. package/dist/src/reporters/rules.js +178 -0
  13. package/dist/src/reporters/sarif.js +235 -0
  14. package/dist/src/reporters/sha256.js +101 -0
  15. package/dist/src/reporters/template.js +877 -0
  16. package/dist/src/run.js +4 -10
  17. package/dist/src/verbs/analyze.js +45 -7
  18. package/dist/src/verbs/describe.js +8 -12
  19. package/dist/src/verbs/explain.js +303 -0
  20. package/jsr.json +1 -1
  21. package/package.json +1 -1
  22. package/src/analysis.ts +14 -4
  23. package/src/config.ts +8 -0
  24. package/src/conformance-record.ts +29 -0
  25. package/src/conformance.ts +21 -23
  26. package/src/findings-pass.ts +5 -7
  27. package/src/report.ts +25 -3
  28. package/src/reporters/annotations.ts +67 -0
  29. package/src/reporters/fingerprint.ts +69 -0
  30. package/src/reporters/json.ts +2 -2
  31. package/src/reporters/reporter.ts +21 -2
  32. package/src/reporters/reporters.ts +18 -1
  33. package/src/reporters/rules.ts +195 -0
  34. package/src/reporters/sarif.ts +287 -0
  35. package/src/reporters/sha256.ts +120 -0
  36. package/src/reporters/template.ts +989 -0
  37. package/src/reporters/text.ts +2 -3
  38. package/src/run.ts +5 -11
  39. package/src/verbs/analyze.ts +57 -7
  40. package/src/verbs/describe.ts +9 -13
  41. package/src/verbs/explain.ts +363 -0
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import type { AnalysisInputs } from "./analysis.ts";
8
- import type { Config, Severity } from "./config.ts";
8
+ import { fails, type Config } from "./config.ts";
9
9
  import type { EdgeEvaluation } from "./edges.ts";
10
10
  import type { CompletedFinding, Finding } from "./finding.ts";
11
11
  import { decidedFindings } from "./findings/emitters.ts";
@@ -44,9 +44,6 @@ export interface PassResult {
44
44
  /** The exit code of a report holding at least one pending finding. */
45
45
  export const EXIT_PENDING = 4;
46
46
 
47
- /** The severities ranked, the strongest highest. */
48
- const SEVERITY_RANK: Readonly<Record<Severity, number>> = { allow: 0, warn: 1, deny: 2 };
49
-
50
47
  /** Two strings ordered bytewise. */
51
48
  function compare(a: string, b: string): number {
52
49
  if (a === b) {
@@ -119,9 +116,10 @@ export function verdictOf(result: PassResult, config: Config): number {
119
116
  if (result.totals.staleSuppressions > 0) {
120
117
  return EXIT_FINDINGS;
121
118
  }
122
- const failing = SEVERITY_RANK[config.reporters.failOn];
123
- const fails = result.findings.some((finding) => SEVERITY_RANK[finding.severity] >= failing);
124
- return fails ? EXIT_FINDINGS : EXIT_CLEAN;
119
+ const failing = result.findings.some((finding) =>
120
+ fails(finding.severity, config.reporters.failOn),
121
+ );
122
+ return failing ? EXIT_FINDINGS : EXIT_CLEAN;
125
123
  }
126
124
 
127
125
  /**
package/src/report.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import type { Severity, Sort, TargetKind } from "./config.ts";
8
- import type { Conformance } from "./conformance.ts";
8
+ import type { Conformance, DeclaredGap } from "./conformance.ts";
9
9
  import type { EdgeEvaluation } from "./edges.ts";
10
10
  import type {
11
11
  CompletedFinding,
@@ -105,6 +105,13 @@ export interface WireStaleSuppression {
105
105
  readonly message: string;
106
106
  }
107
107
 
108
+ interface WireDeclaredGap {
109
+ readonly fixture: string;
110
+ readonly symbol?: string;
111
+ readonly capability: string;
112
+ readonly reason: string;
113
+ }
114
+
108
115
  export interface WireTotals {
109
116
  readonly findings: number;
110
117
  readonly by_severity: { readonly allow: number; readonly warn: number; readonly deny: number };
@@ -159,7 +166,7 @@ export interface Report {
159
166
  readonly findings: readonly WireFinding[];
160
167
  readonly edge_evaluations: readonly WireEdgeEvaluation[];
161
168
  readonly stale_suppressions: readonly WireStaleSuppression[];
162
- readonly declared_gaps: readonly never[];
169
+ readonly declared_gaps: readonly WireDeclaredGap[];
163
170
  readonly excluded_by_cgo: readonly never[];
164
171
  readonly test_file_rules: readonly TestFileRule[];
165
172
  readonly totals: WireTotals;
@@ -170,6 +177,7 @@ export interface ReportInput {
170
177
  readonly contractVersion: string;
171
178
  readonly version: string;
172
179
  readonly conformance: Conformance;
180
+ readonly declaredGaps: readonly DeclaredGap[];
173
181
  readonly target: { readonly kind: TargetKind; readonly root: string; readonly identity: string };
174
182
  readonly configurations: readonly ReportConfiguration[];
175
183
  readonly unavailable: readonly UnavailableConsumer[];
@@ -318,6 +326,16 @@ function canonicalStale(a: WireStaleSuppression, b: WireStaleSuppression): numbe
318
326
  );
319
327
  }
320
328
 
329
+ /** One declared gap as a report carries it, its members in the schema's order. */
330
+ function wireGap(gap: DeclaredGap): WireDeclaredGap {
331
+ return {
332
+ fixture: gap.fixture,
333
+ ...(gap.symbol === undefined ? {} : { symbol: gap.symbol }),
334
+ capability: gap.capability,
335
+ reason: gap.reason,
336
+ };
337
+ }
338
+
321
339
  /** Edge evaluations by edge, then side, then their compact encodings. */
322
340
  function byEdge(a: WireEdgeEvaluation, b: WireEdgeEvaluation): number {
323
341
  return (
@@ -392,7 +410,11 @@ export function buildReport(input: ReportInput): Report {
392
410
  findings,
393
411
  edge_evaluations: input.result.edgeEvaluations.map(wireEvaluation).sort(byEdge),
394
412
  stale_suppressions: input.result.staleSuppressions.map(wireStale).sort(canonicalStale),
395
- declared_gaps: [],
413
+ // Every gap shares the one component of the canonical key a gap supplies, the analyzer's
414
+ // name, so the compact encodings alone order them.
415
+ declared_gaps: input.declaredGaps
416
+ .map(wireGap)
417
+ .sort((a, b) => compare(JSON.stringify(a), JSON.stringify(b))),
396
418
  excluded_by_cgo: [],
397
419
  test_file_rules: [...input.testFileRules]
398
420
  .sort((a, b) => compare(a.rule, b.rule) || a.matched - b.matched)
@@ -0,0 +1,67 @@
1
+ import { fails } from "../config.ts";
2
+ import { KINDS } from "../kinds.ts";
3
+ import type { Report } from "../report.ts";
4
+ import type { RenderOptions } from "./reporter.ts";
5
+
6
+ /** The escapes a workflow command's message needs, so a line break does not end the command. */
7
+ const DATA_ESCAPES: Readonly<Record<string, string>> = { "%": "%25", "\r": "%0D", "\n": "%0A" };
8
+
9
+ /** The escapes a property value needs: a message's, and the property list's two separators. */
10
+ const PROPERTY_ESCAPES: Readonly<Record<string, string>> = {
11
+ ...DATA_ESCAPES,
12
+ ":": "%3A",
13
+ ",": "%2C",
14
+ };
15
+
16
+ function escapeData(value: string): string {
17
+ return value.replace(/[%\r\n]/gu, (char) => DATA_ESCAPES[char] ?? char);
18
+ }
19
+
20
+ function escapeProperty(value: string): string {
21
+ return value.replace(/[%\r\n:,]/gu, (char) => PROPERTY_ESCAPES[char] ?? char);
22
+ }
23
+
24
+ /** The name of the kind a code names, and the code itself where no live kind carries it. */
25
+ function kindName(code: string): string {
26
+ return KINDS.get(code)?.name ?? code;
27
+ }
28
+
29
+ function command(
30
+ level: "error" | "warning",
31
+ at: { readonly path: string; readonly line: number; readonly column: number },
32
+ endLine: number,
33
+ title: string,
34
+ message: string,
35
+ ): string {
36
+ return `::${level} file=${escapeProperty(at.path)},line=${String(at.line)},col=${String(at.column)},endLine=${String(endLine)},title=${escapeProperty(title)}::${escapeData(message)}`;
37
+ }
38
+
39
+ /**
40
+ * One workflow annotation per finding, then one per stale suppression, each naming its
41
+ * file, line, column and last line, titled by its code and kind. A finding at or above the
42
+ * failing severity is an error and one below it a warning; a stale suppression is an error,
43
+ * because its kind is fixed on at the failing severity.
44
+ */
45
+ export function annotations(report: Report, options: RenderOptions): string {
46
+ const lines = report.findings.map((found) =>
47
+ command(
48
+ fails(found.severity, options.failOn) ? "error" : "warning",
49
+ found.position,
50
+ found.position.end_line,
51
+ `${found.code} ${found.kind}`,
52
+ found.message,
53
+ ),
54
+ );
55
+ for (const stale of report.stale_suppressions) {
56
+ lines.push(
57
+ command(
58
+ "error",
59
+ stale.position,
60
+ stale.position.line,
61
+ `${stale.code} ${kindName(stale.code)}`,
62
+ stale.message,
63
+ ),
64
+ );
65
+ }
66
+ return lines.map((line) => `${line}\n`).join("");
67
+ }
@@ -0,0 +1,69 @@
1
+ import { sha256Hex } from "./sha256.ts";
2
+
3
+ /** The unit appended after the last unit of a file. */
4
+ const SENTINEL = 0xffffn;
5
+
6
+ /** The number of significant units one line's hash covers. */
7
+ const WINDOW = 100;
8
+
9
+ const FACTOR = 37n;
10
+
11
+ /** Arithmetic is unsigned 64-bit with wraparound. */
12
+ const MASK = (1n << 64n) - 1n;
13
+
14
+ const SPACE = 0x20;
15
+ const TAB = 0x09;
16
+ const CR = 0x0d;
17
+ const LF = 0x0a;
18
+
19
+ /**
20
+ * The units of one file the line fingerprint counts: every UTF-16 code unit but a space or
21
+ * a tab, a carriage return read as a line feed and the line feed following it dropped, then
22
+ * the sentinel.
23
+ */
24
+ function significantUnits(text: string): bigint[] {
25
+ const kept: bigint[] = [];
26
+ let afterCR = false;
27
+ for (let i = 0; i < text.length; i += 1) {
28
+ const unit = text.charCodeAt(i);
29
+ if (unit === SPACE || unit === TAB || (afterCR && unit === LF)) {
30
+ afterCR = false;
31
+ continue;
32
+ }
33
+ afterCR = unit === CR;
34
+ kept.push(BigInt(afterCR ? LF : unit));
35
+ }
36
+ kept.push(SENTINEL);
37
+ return kept;
38
+ }
39
+
40
+ /**
41
+ * The line fingerprint of every line of one file, indexed from zero. The procedure is the one
42
+ * a code-scanning service computes for a result that carries none, followed exactly, because
43
+ * a value that differs from the service's opens a second alert for one finding.
44
+ */
45
+ export function lineHashes(text: string): readonly string[] {
46
+ const units = significantUnits(text);
47
+ const starts = [0];
48
+ for (let i = 0; i < units.length - 1; i += 1) {
49
+ if (units[i] === BigInt(LF)) {
50
+ starts.push(i + 1);
51
+ }
52
+ }
53
+ const seen = new Map<string, number>();
54
+ return starts.map((start) => {
55
+ let hash = 0n;
56
+ for (let i = start; i < start + WINDOW; i += 1) {
57
+ hash = (hash * FACTOR + (units[i] ?? 0n)) & MASK;
58
+ }
59
+ const rendered = hash.toString(16);
60
+ const count = (seen.get(rendered) ?? 0) + 1;
61
+ seen.set(rendered, count);
62
+ return `${rendered}:${String(count)}`;
63
+ });
64
+ }
65
+
66
+ /** The key a baseline joins on, which a line move leaves unchanged. */
67
+ export function symbolFingerprint(code: string, ref: string): string {
68
+ return sha256Hex(`${code}\n${ref}`);
69
+ }
@@ -1,7 +1,7 @@
1
- import type { Reporter } from "./reporter.ts";
1
+ import type { Report } from "../report.ts";
2
2
 
3
3
  /** The indentation of the report document, which with the schema's member order fixes its bytes. */
4
4
  const INDENT = 2;
5
5
 
6
6
  /** The report document itself: the report, indented, with a closing newline. */
7
- export const json: Reporter = (report) => `${JSON.stringify(report, null, INDENT)}\n`;
7
+ export const json = (report: Report): string => `${JSON.stringify(report, null, INDENT)}\n`;
@@ -1,8 +1,19 @@
1
- import type { Format } from "../config.ts";
1
+ import type { Format, Severity } from "../config.ts";
2
2
  import type { Report } from "../report.ts";
3
+ import type { Template } from "./template.ts";
4
+
5
+ /** What a rendering reads beside the report. */
6
+ export interface RenderOptions {
7
+ /** The lowest severity at which a finding fails the run. */
8
+ readonly failOn: Severity;
9
+ /** The text of the file at one path below the target root, or a throw naming why not. */
10
+ readonly readSource: (path: string) => string;
11
+ /** The template the template rendering renders, where one was named. */
12
+ readonly template: Template | undefined;
13
+ }
3
14
 
4
15
  /** One rendering of a report, as the text of the file it is written to. */
5
- export type Reporter = (report: Report) => string;
16
+ type Reporter = (report: Report, options: RenderOptions) => string;
6
17
 
7
18
  /**
8
19
  * One format this analyzer renders: its reporter, and the suffix appended to the report's
@@ -16,3 +27,11 @@ export interface Rendering {
16
27
 
17
28
  /** Every format this analyzer renders, each by its rendering. */
18
29
  export type Renderings = ReadonlyMap<Format, Rendering>;
30
+
31
+ /** A rendering that cannot be written, which ends the run with the failure code. */
32
+ export class RenderError extends Error {
33
+ constructor(message: string) {
34
+ super(message);
35
+ this.name = "RenderError";
36
+ }
37
+ }
@@ -1,6 +1,9 @@
1
1
  import type { Format } from "../config.ts";
2
+ import { annotations } from "./annotations.ts";
2
3
  import { json } from "./json.ts";
3
- import type { Rendering, Renderings } from "./reporter.ts";
4
+ import { RenderError, type Rendering, type Renderings } from "./reporter.ts";
5
+ import { sarif } from "./sarif.ts";
6
+ import { renderTemplate } from "./template.ts";
4
7
  import { text } from "./text.ts";
5
8
 
6
9
  /**
@@ -10,4 +13,18 @@ import { text } from "./text.ts";
10
13
  export const RENDERINGS: Renderings = new Map<Format, Rendering>([
11
14
  ["text", { render: text, suffix: ".txt" }],
12
15
  ["json", { render: json, suffix: ".json" }],
16
+ ["github", { render: annotations, suffix: ".annotations" }],
17
+ ["sarif", { render: sarif, suffix: ".sarif" }],
18
+ [
19
+ "template",
20
+ {
21
+ render: (report, options) => {
22
+ if (options.template === undefined) {
23
+ throw new RenderError("the template rendering renders a template, and none was named");
24
+ }
25
+ return renderTemplate(options.template, report);
26
+ },
27
+ suffix: ".tmpl",
28
+ },
29
+ ],
13
30
  ]);
@@ -0,0 +1,195 @@
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
+
7
+ /** The text one rule is described with. */
8
+ interface RuleText {
9
+ /** The kind's rule, whole. */
10
+ readonly rule: string;
11
+ /** The condition the kind reports under, where it declares one. */
12
+ readonly precondition?: string;
13
+ }
14
+
15
+ /** Every live issue kind whose languages include this analyzer's, by code, in ascending order. */
16
+ export const RULE_TEXTS: ReadonlyMap<string, RuleText> = new Map<string, RuleText>([
17
+ [
18
+ "DS1001",
19
+ {
20
+ 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.",
21
+ },
22
+ ],
23
+ [
24
+ "DS1002",
25
+ {
26
+ rule: "An unexported symbol with no reference in the target. A symbol referenced only from its own declaration site counts as unreferenced.",
27
+ },
28
+ ],
29
+ [
30
+ "DS1003",
31
+ {
32
+ 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.",
33
+ },
34
+ ],
35
+ [
36
+ "DS1004",
37
+ {
38
+ 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.",
39
+ },
40
+ ],
41
+ [
42
+ "DS1005",
43
+ {
44
+ 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.",
45
+ },
46
+ ],
47
+ [
48
+ "DS1006",
49
+ {
50
+ 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.",
51
+ },
52
+ ],
53
+ [
54
+ "DS1101",
55
+ {
56
+ 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.",
57
+ precondition:
58
+ "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.",
59
+ },
60
+ ],
61
+ [
62
+ "DS1103",
63
+ {
64
+ 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.",
65
+ },
66
+ ],
67
+ [
68
+ "DS1104",
69
+ {
70
+ 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.",
71
+ precondition:
72
+ "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.",
73
+ },
74
+ ],
75
+ [
76
+ "DS1201",
77
+ {
78
+ 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.",
79
+ },
80
+ ],
81
+ [
82
+ "DS1203",
83
+ {
84
+ 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.",
85
+ precondition:
86
+ "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.",
87
+ },
88
+ ],
89
+ [
90
+ "DS1301",
91
+ {
92
+ 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.",
93
+ },
94
+ ],
95
+ [
96
+ "DS1302",
97
+ {
98
+ 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.",
99
+ },
100
+ ],
101
+ [
102
+ "DS1303",
103
+ {
104
+ 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.",
105
+ precondition:
106
+ "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.",
107
+ },
108
+ ],
109
+ [
110
+ "DS1501",
111
+ {
112
+ 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.",
113
+ precondition:
114
+ '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.',
115
+ },
116
+ ],
117
+ [
118
+ "DS1502",
119
+ {
120
+ 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.",
121
+ },
122
+ ],
123
+ [
124
+ "DS1601",
125
+ {
126
+ 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.",
127
+ precondition:
128
+ "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.",
129
+ },
130
+ ],
131
+ [
132
+ "DS1701",
133
+ {
134
+ 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.",
135
+ },
136
+ ],
137
+ [
138
+ "DS1702",
139
+ {
140
+ 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.",
141
+ },
142
+ ],
143
+ [
144
+ "DS1703",
145
+ {
146
+ 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.",
147
+ },
148
+ ],
149
+ [
150
+ "DS1704",
151
+ {
152
+ 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.",
153
+ },
154
+ ],
155
+ [
156
+ "DS1705",
157
+ {
158
+ 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.",
159
+ },
160
+ ],
161
+ [
162
+ "DS1801",
163
+ {
164
+ rule: "A parameter with no reference inside its function body, on a function whose signature is free to change.",
165
+ precondition:
166
+ "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.",
167
+ },
168
+ ],
169
+ [
170
+ "DS1803",
171
+ {
172
+ rule: "A result value that no call site of the function uses, on a function whose signature is free to change.",
173
+ precondition:
174
+ "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.",
175
+ },
176
+ ],
177
+ [
178
+ "DS1805",
179
+ {
180
+ rule: "A statement that control flow cannot reach, at the precision the language's compiler applies to the same construct.",
181
+ },
182
+ ],
183
+ [
184
+ "DS1807",
185
+ {
186
+ 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.",
187
+ },
188
+ ],
189
+ [
190
+ "DS1809",
191
+ {
192
+ rule: "A switch case whose type or value an earlier case in the same switch already covers.",
193
+ },
194
+ ],
195
+ ]);