@cplieger/deadset-ts 8.0.0-dev.5 → 8.0.0-dev.7
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/dist/bin/mapper-connection.js +2 -1
- package/dist/bin/node-host.js +3 -2
- package/dist/src/analysis.js +28 -46
- package/dist/src/automatic-types.js +10 -29
- package/dist/src/build-scripts.js +17 -29
- package/dist/src/component-layer.js +4 -2
- package/dist/src/components.js +2 -3
- package/dist/src/config.js +3 -2
- package/dist/src/configuration-files.js +27 -168
- package/dist/src/conformance-record.js +1 -1
- package/dist/src/contract/contract.generated.js +1084 -0
- package/dist/src/contract/report.generated.js +796 -0
- package/dist/src/conventions.js +20 -60
- package/dist/src/dependencies.js +25 -43
- package/dist/src/discover.js +13 -39
- package/dist/src/edges.js +7 -15
- package/dist/src/element-access.js +4 -6
- package/dist/src/entry-point-gaps.js +2 -8
- package/dist/src/entry-points.js +3 -10
- package/dist/src/enum-group.js +3 -10
- package/dist/src/erased-stores.js +4 -6
- package/dist/src/exempt-classes.js +3 -63
- package/dist/src/exempt.js +13 -40
- package/dist/src/file-facts.js +2 -25
- package/dist/src/findings/completion.js +11 -20
- package/dist/src/findings/dependencies-and-module-machinery.js +4 -5
- package/dist/src/findings/emitters.js +4 -4
- package/dist/src/findings/interfaces.js +4 -5
- package/dist/src/findings/intra-function.js +8 -7
- package/dist/src/findings/non-code-artifacts.js +5 -6
- package/dist/src/findings/reads-and-writes.js +11 -9
- package/dist/src/findings/self-check.js +10 -12
- package/dist/src/findings/unused-declarations.js +28 -27
- package/dist/src/findings/visibility-narrowing.js +9 -11
- package/dist/src/findings-pass.js +7 -14
- package/dist/src/fs/manifest.js +43 -0
- package/dist/src/fs/tree.js +88 -0
- package/dist/src/git-ignore.js +34 -25
- package/dist/src/html-entries.js +6 -33
- package/dist/src/in-operands.js +2 -1
- package/dist/src/index.js +1 -1
- package/dist/src/intra-function-parts.js +18 -26
- package/dist/src/inventory.js +2 -21
- package/dist/src/json-document.js +4 -0
- package/dist/src/keyof-comparisons.js +4 -6
- package/dist/src/kinds.js +4 -360
- package/dist/src/manifest.js +5 -43
- package/dist/src/mdx-entries.js +3 -26
- package/dist/src/partial.js +2 -1
- package/dist/src/paths.js +26 -15
- package/dist/src/position.js +2 -1
- package/dist/src/print.js +3 -2
- package/dist/src/product.js +13 -0
- package/dist/src/references.js +14 -27
- package/dist/src/report-schema.js +272 -0
- package/dist/src/report.js +39 -42
- package/dist/src/reporters/sarif.js +4 -2
- package/dist/src/reporters/template.js +4 -19
- package/dist/src/resolve.js +12 -26
- package/dist/src/roots.js +7 -17
- package/dist/src/run.js +10 -8
- package/dist/src/schema.js +4 -3
- package/dist/src/scope.js +4 -5
- package/dist/src/serialization-contract.js +4 -8
- package/dist/src/session.js +2 -1
- package/dist/src/setup-failure.js +2 -6
- package/dist/src/suppress-file.js +12 -13
- package/dist/src/suppress-inline.js +3 -2
- package/dist/src/suppress.js +29 -48
- package/dist/src/symbol-keys.js +3 -5
- package/dist/src/template-field.js +5 -15
- package/dist/src/test-globals.js +6 -28
- package/dist/src/test-joins.js +6 -6
- package/dist/src/text/compare.js +26 -0
- package/dist/src/text/glob.js +194 -0
- package/dist/src/text/shell.js +159 -0
- package/dist/src/{yaml-document.js → text/yaml.js} +38 -0
- package/dist/src/type-errors.js +14 -38
- package/dist/src/unseen-loads.js +2 -9
- package/dist/src/unwrap.js +23 -0
- package/dist/src/verbs/analyze.js +22 -15
- package/dist/src/verbs/describe.js +7 -7
- package/dist/src/verbs/explain.js +7 -4
- package/dist/src/verbs/print-config.js +2 -1
- package/dist/src/verbs/print-projects.js +4 -2
- package/dist/src/verbs/print-retained.js +4 -2
- package/dist/src/verbs/print-roots.js +4 -2
- package/dist/src/verbs/verb.js +1 -5
- package/dist/src/verbs/version.js +4 -3
- package/dist/src/workflow-steps.js +9 -46
- package/dist/src/workspace-manifests.js +2 -2
- package/dist/src/workspace-programs.js +5 -3
- package/dist/src/workspace-resolution.js +13 -17
- package/dist/src/workspace.js +28 -116
- package/jsr.json +1 -1
- package/package.json +2 -1
- package/src/analysis.ts +29 -54
- package/src/automatic-types.ts +11 -29
- package/src/build-scripts.ts +17 -38
- package/src/component-layer.ts +4 -2
- package/src/components.ts +2 -4
- package/src/config.ts +11 -15
- package/src/configuration-files.ts +27 -170
- package/src/conformance-record.ts +1 -1
- package/src/contract/contract.generated.ts +1148 -0
- package/src/contract/report.generated.ts +1157 -0
- package/src/conventions.ts +26 -74
- package/src/dependencies.ts +32 -50
- package/src/discover.ts +14 -39
- package/src/edges.ts +7 -21
- package/src/element-access.ts +4 -7
- package/src/entry-point-gaps.ts +3 -9
- package/src/entry-points.ts +2 -13
- package/src/enum-group.ts +2 -11
- package/src/erased-stores.ts +3 -7
- package/src/exempt-classes.ts +5 -74
- package/src/exempt.ts +17 -47
- package/src/file-facts.ts +6 -24
- package/src/finding.ts +9 -9
- package/src/findings/completion.ts +22 -23
- package/src/findings/dependencies-and-module-machinery.ts +4 -7
- package/src/findings/emitter.ts +6 -7
- package/src/findings/emitters.ts +6 -6
- package/src/findings/interfaces.ts +4 -6
- package/src/findings/intra-function.ts +8 -8
- package/src/findings/non-code-artifacts.ts +5 -7
- package/src/findings/reads-and-writes.ts +15 -12
- package/src/findings/self-check.ts +11 -17
- package/src/findings/unused-declarations.ts +28 -27
- package/src/findings/visibility-narrowing.ts +9 -12
- package/src/findings-pass.ts +7 -16
- package/src/fs/manifest.ts +52 -0
- package/src/fs/tree.ts +110 -0
- package/src/git-ignore.ts +38 -25
- package/src/html-entries.ts +6 -33
- package/src/in-operands.ts +2 -1
- package/src/index.ts +1 -1
- package/src/intra-function-parts.ts +18 -28
- package/src/inventory.ts +2 -20
- package/src/json-document.ts +5 -0
- package/src/keyof-comparisons.ts +3 -7
- package/src/kinds.ts +6 -406
- package/src/manifest.ts +5 -46
- package/src/mdx-entries.ts +3 -26
- package/src/partial.ts +2 -1
- package/src/paths.ts +27 -15
- package/src/position.ts +2 -1
- package/src/print.ts +3 -2
- package/src/product.ts +18 -0
- package/src/references.ts +14 -29
- package/src/report-schema.ts +364 -0
- package/src/report.ts +66 -229
- package/src/reporters/annotations.ts +2 -2
- package/src/reporters/json.ts +1 -1
- package/src/reporters/reporter.ts +2 -2
- package/src/reporters/reporters.ts +1 -1
- package/src/reporters/sarif.ts +17 -12
- package/src/reporters/template.ts +4 -20
- package/src/reporters/text.ts +3 -3
- package/src/resolve.ts +31 -38
- package/src/roots.ts +7 -20
- package/src/run.ts +10 -14
- package/src/schema.ts +4 -3
- package/src/scope.ts +4 -10
- package/src/serialization-contract.ts +4 -9
- package/src/session.ts +2 -1
- package/src/setup-failure.ts +5 -7
- package/src/suppress-file.ts +11 -15
- package/src/suppress-inline.ts +2 -2
- package/src/suppress.ts +39 -55
- package/src/symbol-keys.ts +2 -5
- package/src/template-field.ts +5 -18
- package/src/test-globals.ts +9 -27
- package/src/test-joins.ts +6 -8
- package/src/text/compare.ts +27 -0
- package/src/text/glob.ts +210 -0
- package/src/text/shell.ts +161 -0
- package/src/{yaml-document.ts → text/yaml.ts} +46 -0
- package/src/type-errors.ts +25 -36
- package/src/unseen-loads.ts +1 -12
- package/src/unwrap.ts +34 -0
- package/src/verbs/analyze.ts +38 -25
- package/src/verbs/describe.ts +13 -7
- package/src/verbs/explain.ts +7 -4
- package/src/verbs/print-config.ts +2 -1
- package/src/verbs/print-projects.ts +4 -2
- package/src/verbs/print-retained.ts +4 -2
- package/src/verbs/print-roots.ts +4 -2
- package/src/verbs/verb.ts +0 -6
- package/src/verbs/version.ts +4 -3
- package/src/workflow-steps.ts +9 -44
- package/src/workspace-manifests.ts +2 -2
- package/src/workspace-programs.ts +5 -3
- package/src/workspace-resolution.ts +21 -17
- package/src/workspace.ts +35 -121
- package/dist/src/glob.js +0 -65
- package/dist/src/pnpm-workspace.js +0 -120
- package/dist/src/version.js +0 -7
- package/src/glob.ts +0 -67
- package/src/pnpm-workspace.ts +0 -135
- package/src/version.ts +0 -7
|
@@ -0,0 +1,1084 @@
|
|
|
1
|
+
// Code generated by scripts/gen-contract.ts from the Contract copy under fixtures/ (npm run gen). DO NOT EDIT.
|
|
2
|
+
export const CONTRACT_VERSION = "8.0.0";
|
|
3
|
+
export const SCHEMA_VERSIONS = ["9.0.0"];
|
|
4
|
+
export const SCHEMA_VERSION = "9.0.0";
|
|
5
|
+
export const CORPUS_VERSION = "6.0.0";
|
|
6
|
+
export const CODE_PREFIX = "DS";
|
|
7
|
+
export const FAMILY_KEY_LENGTH = 4;
|
|
8
|
+
export const LANGUAGES = ["go", "ts"];
|
|
9
|
+
export const SEVERITIES = ["allow", "warn", "deny"];
|
|
10
|
+
export const CONFIDENCES = [
|
|
11
|
+
"certain",
|
|
12
|
+
"probable",
|
|
13
|
+
"possible",
|
|
14
|
+
];
|
|
15
|
+
export const FORMATS = [
|
|
16
|
+
"text",
|
|
17
|
+
"json",
|
|
18
|
+
"github",
|
|
19
|
+
"sarif",
|
|
20
|
+
"template",
|
|
21
|
+
];
|
|
22
|
+
/** Each analyzed language's row: its analyzer, the names that mark it and the directories it skips. */
|
|
23
|
+
export const LANGUAGE_ROWS = {
|
|
24
|
+
go: {
|
|
25
|
+
analyzer: "deadset-go",
|
|
26
|
+
markers: ["go.mod"],
|
|
27
|
+
skippedDirectories: ["node_modules", "testdata", "vendor", ".*", "_*"],
|
|
28
|
+
},
|
|
29
|
+
ts: {
|
|
30
|
+
analyzer: "deadset-ts",
|
|
31
|
+
markers: ["tsconfig*.json"],
|
|
32
|
+
skippedDirectories: ["node_modules", ".git"],
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export const EXIT_CLEAN = 0;
|
|
36
|
+
export const EXIT_FINDINGS = 1;
|
|
37
|
+
export const EXIT_USAGE = 2;
|
|
38
|
+
export const EXIT_FAILURE = 3;
|
|
39
|
+
export const EXIT_PENDING = 4;
|
|
40
|
+
export const KIND_ROWS = [
|
|
41
|
+
{
|
|
42
|
+
code: "DS1001",
|
|
43
|
+
name: "unused-exported",
|
|
44
|
+
languages: ["go", "ts"],
|
|
45
|
+
subject: "declaration",
|
|
46
|
+
holdsLive: false,
|
|
47
|
+
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.",
|
|
48
|
+
details: { name_literal: "optional" },
|
|
49
|
+
defaultEnabled: true,
|
|
50
|
+
defaultSeverity: "deny",
|
|
51
|
+
maxClass: "certain",
|
|
52
|
+
fixability: "deletable",
|
|
53
|
+
findingFixabilities: ["manual"],
|
|
54
|
+
fixed: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
code: "DS1002",
|
|
58
|
+
name: "unused-unexported",
|
|
59
|
+
languages: ["go", "ts"],
|
|
60
|
+
subject: "declaration",
|
|
61
|
+
holdsLive: false,
|
|
62
|
+
rule: "An unexported symbol with no reference in the target. A symbol referenced only from its own declaration site counts as unreferenced. In Go a constant or a type a function body declares, a function literal's body included, that nothing in that body names outside its own specification is reported under this code, under the reference of the enclosing declaration, as `grammar/symbol-ref.md` states for a declaration inside a function body, at the local declaration's own position, with `symbol.kind` `constant` or `type` and the liveness relation `reference-counting`.",
|
|
63
|
+
details: { name_literal: "optional" },
|
|
64
|
+
defaultEnabled: true,
|
|
65
|
+
defaultSeverity: "deny",
|
|
66
|
+
maxClass: "certain",
|
|
67
|
+
fixability: "deletable",
|
|
68
|
+
findingFixabilities: ["manual"],
|
|
69
|
+
fixed: false,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
code: "DS1003",
|
|
73
|
+
name: "unused-member",
|
|
74
|
+
languages: ["go", "ts"],
|
|
75
|
+
subject: "declaration",
|
|
76
|
+
holdsLive: false,
|
|
77
|
+
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.",
|
|
78
|
+
precondition: "A TypeScript member that no value writes and nothing reads, whose type names a type parameter of its declaring interface, class or type alias, is not reported when every part of that declaration that names the type parameter is a member no value writes and nothing reads. TypeScript compares object types by their members, so such members are what make two instantiations of their type distinct types, and deleting them leaves the type parameter phantom and lets one instantiation stand for another. A member a value writes is decided by the rule of DS1301 instead, whatever its type names.",
|
|
79
|
+
details: {},
|
|
80
|
+
defaultEnabled: true,
|
|
81
|
+
defaultSeverity: "deny",
|
|
82
|
+
maxClass: "certain",
|
|
83
|
+
fixability: "deletable",
|
|
84
|
+
findingFixabilities: ["manual"],
|
|
85
|
+
fixed: false,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
code: "DS1004",
|
|
89
|
+
name: "unused-import",
|
|
90
|
+
languages: ["ts"],
|
|
91
|
+
subject: "binding",
|
|
92
|
+
holdsLive: false,
|
|
93
|
+
rule: "A name a TypeScript import declaration binds, or an `import x = require()` declaration that is not exported, a symbol of its own file beside the declaration it imports, reported at the binding when nothing in the file reads it: a use in a type position, in a local export or in a type, a link or a `@see` tag of a doc comment reads it, and so does JSX the compiler turns into calls of a factory it names. A binding of a declaration file or of a component file is not judged, nor one of a generated file while generated files are excluded.",
|
|
94
|
+
details: {},
|
|
95
|
+
defaultEnabled: true,
|
|
96
|
+
defaultSeverity: "deny",
|
|
97
|
+
maxClass: "certain",
|
|
98
|
+
fixability: "deletable",
|
|
99
|
+
fixed: false,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
code: "DS1005",
|
|
103
|
+
name: "unused-enum-member",
|
|
104
|
+
languages: ["go", "ts"],
|
|
105
|
+
subject: "declaration",
|
|
106
|
+
holdsLive: false,
|
|
107
|
+
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.",
|
|
108
|
+
details: {},
|
|
109
|
+
defaultEnabled: true,
|
|
110
|
+
defaultSeverity: "deny",
|
|
111
|
+
maxClass: "certain",
|
|
112
|
+
fixability: "deletable",
|
|
113
|
+
findingFixabilities: ["manual"],
|
|
114
|
+
fixed: false,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
code: "DS1006",
|
|
118
|
+
name: "unused-type-parameter",
|
|
119
|
+
languages: ["go", "ts"],
|
|
120
|
+
subject: "declaration",
|
|
121
|
+
holdsLive: false,
|
|
122
|
+
rule: "A type parameter of a function, a method or a TypeScript type alias that no part of the declaration's signature, body or aliased type names, at the certain class. The deletion is local to the declaration and the explicit instantiations the reference set already lists. A type parameter of a declaration that is itself dead falls with it and is reported under no code of its own.",
|
|
123
|
+
precondition: "Function and method type parameters, and in TypeScript those of a type alias. A TypeScript alias names no type of its own, so two instantiations that differ only in a parameter its type never names are one type. A Go type declaration's type parameter 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. Nor is one of a TypeScript class or interface, which merges only with declarations of the same type parameters. A method signature an interface or an object type declares belongs to that type declaration, so its type parameters are never reported either.",
|
|
124
|
+
details: {},
|
|
125
|
+
defaultEnabled: true,
|
|
126
|
+
defaultSeverity: "deny",
|
|
127
|
+
maxClass: "certain",
|
|
128
|
+
fixability: "deletable",
|
|
129
|
+
fixed: false,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
code: "DS1101",
|
|
133
|
+
name: "unreachable-export",
|
|
134
|
+
languages: ["go", "ts"],
|
|
135
|
+
subject: "declaration",
|
|
136
|
+
holdsLive: false,
|
|
137
|
+
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, except where the confidence rule of grammar/analysis/confidence.md gives a declaration a string literal spells the class possible.",
|
|
138
|
+
details: { name_literal: "optional" },
|
|
139
|
+
defaultEnabled: true,
|
|
140
|
+
defaultSeverity: "deny",
|
|
141
|
+
maxClass: "certain",
|
|
142
|
+
fixability: "deletable",
|
|
143
|
+
findingFixabilities: ["manual"],
|
|
144
|
+
derivedFrom: ["DS1001"],
|
|
145
|
+
fixed: false,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
code: "DS1102",
|
|
149
|
+
name: "test-only-use",
|
|
150
|
+
languages: ["go", "ts"],
|
|
151
|
+
subject: "declaration",
|
|
152
|
+
holdsLive: false,
|
|
153
|
+
rule: "A symbol with zero production references and at least one test reference: an unused-exported, unused-unexported or unused-member 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. A reference from test-support code, a package or file that only tests reach and that carries test evidence of its own language, is a test reference. A declaration of test-support code is test code and is no subject of this code, as grammar/analysis/tests.md states. An interface method whose only calls and selections through the interface are in test code, and that DS1202's precondition does not exempt, is reported under this code. The methods implementing it are not reported with it, because the test reaches them through it. A candidate found dead under reachability, every production reference to which is made by a declaration itself dead, is reported under this code as well where test code that is no test of dead code, and that the run counting test references reaches, references it, because that test keeps it, and the finding's message names both kinds of reference.",
|
|
154
|
+
details: { name_literal: "optional" },
|
|
155
|
+
defaultEnabled: true,
|
|
156
|
+
defaultSeverity: "deny",
|
|
157
|
+
maxClass: "certain",
|
|
158
|
+
fixability: "deletable",
|
|
159
|
+
findingFixabilities: ["manual"],
|
|
160
|
+
derivedFrom: ["DS1001", "DS1002", "DS1003"],
|
|
161
|
+
fixed: false,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
code: "DS1103",
|
|
165
|
+
name: "test-of-dead-code",
|
|
166
|
+
languages: ["go", "ts"],
|
|
167
|
+
subject: "declaration",
|
|
168
|
+
holdsLive: false,
|
|
169
|
+
rule: "A test symbol whose set of referenced target symbols is non-empty and every member of that set is reported dead. In TypeScript an ambient declaration, one a declaration file holds or one a `declare` modifier carries or a declaration carrying one holds, describes code the target does not implement, so it is no target symbol of that set. 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. A production declaration whose reachability class is `possible` because programs outside the analysis may use it, being published API of a library whose run declares no consumer, and in Go a declaration of a package no build links or an export of a unit a dropped module requires, counts as a live target symbol of every test that references it, so such a test is no test of dead code. The declaration is still reported at `possible`. The test joins the dead component of the symbols it references, and it and each of them count as referencing each other, so the test is a member of their cycle and never a dead symbol outside it.",
|
|
170
|
+
details: {},
|
|
171
|
+
defaultEnabled: true,
|
|
172
|
+
defaultSeverity: "deny",
|
|
173
|
+
maxClass: "certain",
|
|
174
|
+
fixability: "deletable",
|
|
175
|
+
findingFixabilities: ["manual"],
|
|
176
|
+
fixed: false,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
code: "DS1104",
|
|
180
|
+
name: "deprecated-unused",
|
|
181
|
+
languages: ["go", "ts"],
|
|
182
|
+
subject: "declaration",
|
|
183
|
+
holdsLive: false,
|
|
184
|
+
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.",
|
|
185
|
+
details: { name_literal: "optional" },
|
|
186
|
+
defaultEnabled: true,
|
|
187
|
+
defaultSeverity: "deny",
|
|
188
|
+
maxClass: "certain",
|
|
189
|
+
fixability: "deletable",
|
|
190
|
+
findingFixabilities: ["manual"],
|
|
191
|
+
derivedFrom: ["DS1001", "DS1002", "DS1003"],
|
|
192
|
+
fixed: false,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
code: "DS1201",
|
|
196
|
+
name: "unused-interface",
|
|
197
|
+
languages: ["go", "ts"],
|
|
198
|
+
subject: "declaration",
|
|
199
|
+
holdsLive: false,
|
|
200
|
+
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.",
|
|
201
|
+
details: { implementations: "required" },
|
|
202
|
+
defaultEnabled: true,
|
|
203
|
+
defaultSeverity: "deny",
|
|
204
|
+
maxClass: "certain",
|
|
205
|
+
fixability: "deletable",
|
|
206
|
+
findingFixabilities: ["manual"],
|
|
207
|
+
fixed: false,
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
code: "DS1202",
|
|
211
|
+
name: "uncalled-interface-method",
|
|
212
|
+
languages: ["go", "ts"],
|
|
213
|
+
subject: "declaration",
|
|
214
|
+
holdsLive: false,
|
|
215
|
+
rule: "An interface method that no call site invokes or selects through the interface, whatever the number of implementations. A call or selection in test code is no call for this rule, and an interface method only test code calls is DS1102's. The finding names the concrete implementations and their positions. Each method that implements it and that nothing else keeps is reported under the code its own references select. Such a method counts as referenced by the interface method alone, so it belongs to this finding's dead component, whose root member is the interface method.",
|
|
216
|
+
precondition: "In Go, every method of an exported interface whose method set holds an unexported method is exempt, a method of an interface it embeds included. An unexported interface restricts no implementor outside its package, so a method only it holds is judged. That is the sum-type shape, whose method set exists to restrict the implementors, and a TypeScript interface cannot take it because it declares no member less visible than itself. In both languages, every marker method is exempt, an interface method whose every implementation carries an empty body.",
|
|
217
|
+
details: { implementations: "required" },
|
|
218
|
+
defaultEnabled: true,
|
|
219
|
+
defaultSeverity: "warn",
|
|
220
|
+
maxClass: "certain",
|
|
221
|
+
fixability: "manual",
|
|
222
|
+
fixed: false,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
code: "DS1203",
|
|
226
|
+
name: "unused-satisfaction-assertion",
|
|
227
|
+
languages: ["go"],
|
|
228
|
+
subject: "declaration",
|
|
229
|
+
holdsLive: true,
|
|
230
|
+
rule: "A compile-time satisfaction assertion whose interface no symbol uses as a type.",
|
|
231
|
+
precondition: "In a library, an assertion whose interface and whose concrete type are both published API, each an exported declaration of a package outside programs can import, is not reported: it states to every importer a promise of the published API. An assertion whose interface alone is published API has the reachability class possible, whatever consumers the run declares and loads. The assertion checks a promise the published API makes, that the type satisfies the published interface, and that promise is made to every program that imports the package, not only to the consumers the run declares. A loaded consumer that names the interface as a type uses it, and the assertion is not reported.",
|
|
232
|
+
details: { implementations: "required" },
|
|
233
|
+
defaultEnabled: true,
|
|
234
|
+
defaultSeverity: "deny",
|
|
235
|
+
maxClass: "certain",
|
|
236
|
+
fixability: "deletable",
|
|
237
|
+
fixed: false,
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
code: "DS1301",
|
|
241
|
+
name: "write-only-symbol",
|
|
242
|
+
languages: ["go", "ts"],
|
|
243
|
+
subject: "declaration",
|
|
244
|
+
holdsLive: true,
|
|
245
|
+
rule: "A package-level or module-level variable, struct field, class member, type member or collection that production code writes and never reads. In production mode a read from a test file counts as no read. A write from a loaded consumer's code counts as a read, because the deletion the finding names would break a consumer the target does not own. A write in a consumer's test file counts as a read in the run that counts test references. It counts in a production sweep only where the configuration counts consumer tests as production. In Go a read counts only from a declaration that is live under the finding's liveness relation, which is reference counting: a read from a declaration nothing references, whose own finding has the reachability class `certain`, is no read, so a declaration that only such declarations read is reported where a declaration something references writes it. 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 Go a type argument the program instantiates a type parameter with, where the parameter's constraint is `comparable` or embeds it, is compared as an operand of `==` of that type is, recorded at the instantiation, so the struct values `slices.Equal`, `slices.Index` or `maps.Equal` compares have every field read. `reflect.DeepEqual` is not a comparison under this rule. In Go, a conversion the compiler accepts between two struct types, or between two pointer types that are not named types and whose base types are struct types, reads every field of the two struct types where their struct type literals are distinct, recorded at the conversion, because the conversion is legal only while their fields are identical, ignoring tags, and so no field of either can be deleted alone. It reads in the same way every field of each pair of distinct struct type literals the identity of the two types compares in turn: through each field's type, and from there through the element, key, base, parameter and result types of the type literals it reaches, through the method signatures of an interface type literal, and through the type arguments of an instantiated generic type. A field reached there has no reference of its own, as grammar/symbol-ref.md states, so it is never a subject and those reads hold no finding back. It stops at a defined type, whose fields the conversion does not read, because a defined type is identical to itself whatever fields it declares. A pair whose two sides are one struct type literal, the two struct types themselves included, as where one type is declared from the other or the conversion is to the operand's own type, reads nothing, because a field deleted from that literal leaves both sides identical. Where the operand's type or the conversion's type is a type parameter, the struct type its constraint's core type is takes that side's place, and a type parameter operand reads in the same way the fields of each struct type argument an instantiation the program holds gives it, an instantiation made through another generic declaration's own type parameters included. A conversion to any other type, an interface type among them, reads no field under this rule. In TypeScript a comparison of two object references reads no member, because `===` compares identity and never a member. A TypeScript parameter property, a constructor parameter that carries a modifier, declares a member of its class that the constructor writes with its argument, so the member is judged under this rule, and under every rule that reads a class member, as a member the class body declares is. In TypeScript a property of an object literal writes the member of the same name that the literal's contextual type declares, whether or not the compiler checks the literal for excess properties. Where that contextual type is a union or an intersection, the property writes the member of that name on each constituent that declares one. So a literal that a declaration annotates, a function returns, a call passes or a `satisfies` expression checks writes the members of the type it is given. A literal whose type the compiler infers, as one a callback returns to a generic call, writes in the same way the member of each property's name that each object type a value of the literal's type reaches declares, through array elements, type arguments and the parameters and results of functions, so `ids.map((id) => ({ id }))` returned as `Row[]` writes `Row.id`. An object literal handed to a callee the target does not implement has its members read, as grammar/analysis/references-ts.md states. A store through the value a field or a member holds reads that field or member rather than writing it, because the store lands in storage every other holder of the value reads. In Go that store is an assignment, an increment, a compound assignment or a `delete` whose target is reached through a struct field holding a map, a slice or a pointer. Examples are `s.f[k] = v`, `s.f.x = v` and `delete(s.f, k)`. The same store through a field holding an array or a struct is a store into the field itself. TypeScript holds every object by reference, so an element or property store through a member's value reads the member. The finding names each write position, so the deletion set is visible. Deleting the subject and its writes also deletes every declaration whose only uses they hold. Such a declaration is a type parameter of the subject's declaring type that the subject's type alone names, an import binding the writes alone use, or a declaration whose every use is in the type annotation of the subject or of another subject this rule reports, or in the writes those findings name. The finding's message names each such declaration, and no finding is reported about the declaration itself.",
|
|
246
|
+
details: { write_positions: "required" },
|
|
247
|
+
defaultEnabled: true,
|
|
248
|
+
defaultSeverity: "deny",
|
|
249
|
+
maxClass: "certain",
|
|
250
|
+
fixability: "deletable",
|
|
251
|
+
fixed: false,
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
code: "DS1401",
|
|
255
|
+
name: "unused-parameter",
|
|
256
|
+
languages: ["go", "ts"],
|
|
257
|
+
subject: "part",
|
|
258
|
+
holdsLive: false,
|
|
259
|
+
rule: "A parameter with no reference inside its function body, on a function whose signature is free to change.",
|
|
260
|
+
precondition: "The signature must be free, defined as follows: the function is not a method retained by interface satisfaction, is not a method whose name and signature are those of a method of an exported interface type declared by a package outside the target that the import closure holds, is not used as a value, is not a go:linkname or cgo target, is not a go-fuzz entry point, is not a function the Go test driver runs (a test, benchmark or fuzz test of a test file, or TestMain), and is not a stub whose body is empty or only panics. A function literal or function expression that initializes a variable the program only calls, never passing, storing, returning or assigning it, is called by name and is not used as a value. In Go a function literal that is the callee of the call it is written in, the call of a `go` or a `defer` statement included, is not used as a value, wherever the literal is written. 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. In TypeScript a caller may pass a function used as a value more arguments than it declares parameters, so in such a function whose signature is free but for that use, a parameter its body never reads is reported for deletion when its body reads no parameter after it, and an unread parameter before the last read one is reported for a rename to its name with a leading underscore, which keeps every argument in place and which the compilers' unused-parameter rules read as declared unread, unless its name already starts with one. A parameter of a TypeScript function expression or arrow function that the compiler gives a contextual type, and that carries a type annotation, is not reported for deletion where the inference of the call holding the function may read the annotation, being where the callee is generic and its parameter type at the function's place names a type parameter at the parameter's place, or where the function is written inside an object literal such a call is passed, and it is reported for deletion at `probable` where it carries an annotation no such inference reads, because nothing in the program shows that an outside reader ignores it. A name an object binding pattern of a parameter of such a function binds, annotated or not, that the body never reads is reported for deletion at `probable`, because the pattern reads the property it names from the argument and the code that hands the argument may act on that read, which nothing in the program shows. Any other TypeScript parameter that is a binding pattern is judged by the names it binds: each name the body never reads is reported wherever the pattern stands, because removing it from the pattern moves no argument, except a name beside a rest element of the same object pattern, whose removal changes what that element holds, and the pattern counts as a read parameter when the body reads any name it binds. A rest parameter is judged as the last parameter. A TypeScript `this` parameter declares the type of `this` and receives no argument, so it is never reported. A TypeScript constructor is used as a value where its class is used as a value other than as the callee of a `new` expression or the class an `extends` clause names, and its signature is not free where its class carries a decorator or a parameter of the constructor carries one, because the code that decorator or a container runs may construct the class. A parameter property is read by the write to its member the constructor makes, so it is never reported under this kind, and its member is judged under DS1301. A TypeScript name a parameter binds, whole or through a binding pattern, that starts with an underscore is never reported, because a leading underscore is the spelling unused-parameter rules read as declared unread, and no other name exempts a parameter. A Go parameter named by the blank identifier declares no name a body could read and is never reported.",
|
|
261
|
+
details: { overlap: "required" },
|
|
262
|
+
defaultEnabled: true,
|
|
263
|
+
defaultSeverity: "warn",
|
|
264
|
+
maxClass: "certain",
|
|
265
|
+
fixability: "manual",
|
|
266
|
+
overlap: {
|
|
267
|
+
go: ["revive unused-parameter", "gopls unusedparams", "unparam"],
|
|
268
|
+
ts: ["tsc --noUnusedParameters", "@typescript-eslint/no-unused-vars"],
|
|
269
|
+
},
|
|
270
|
+
fixed: false,
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
code: "DS1402",
|
|
274
|
+
name: "unused-receiver",
|
|
275
|
+
languages: ["go"],
|
|
276
|
+
subject: "part",
|
|
277
|
+
holdsLive: false,
|
|
278
|
+
rule: "A named method receiver with no reference inside the method body. Go permits a method with no receiver name, so the fix deletes an identifier and changes no signature.",
|
|
279
|
+
precondition: "None beyond the rule. Deleting a receiver name changes no signature, so a method retained by interface satisfaction, a method used as a value and a stub are reported as any other method is.",
|
|
280
|
+
details: { overlap: "required" },
|
|
281
|
+
defaultEnabled: true,
|
|
282
|
+
defaultSeverity: "warn",
|
|
283
|
+
maxClass: "certain",
|
|
284
|
+
fixability: "deletable",
|
|
285
|
+
overlap: { go: ["revive unused-receiver"], ts: ["not applicable"] },
|
|
286
|
+
fixed: false,
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
code: "DS1403",
|
|
290
|
+
name: "unused-result",
|
|
291
|
+
languages: ["go", "ts"],
|
|
292
|
+
subject: "part",
|
|
293
|
+
holdsLive: false,
|
|
294
|
+
rule: "A result value that no call site of the function uses, on a function whose signature is free to change.",
|
|
295
|
+
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. A function a program run by naming the file names, a file under the `ignore` tag or a script of a dropped module, has call sites outside the loaded graph. A call that is the operand of an await expression written as a statement of its own uses a result whose type has a member named then, a promise or another thenable, because the caller sequences on it, and discards any other result. A call written as a statement of its own, or as the operand of void, discards its result whatever its type.",
|
|
296
|
+
details: { overlap: "required" },
|
|
297
|
+
defaultEnabled: true,
|
|
298
|
+
defaultSeverity: "warn",
|
|
299
|
+
maxClass: "certain",
|
|
300
|
+
fixability: "manual",
|
|
301
|
+
overlap: { go: ["unparam"], ts: ["none known"] },
|
|
302
|
+
fixed: false,
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
code: "DS1404",
|
|
306
|
+
name: "dead-store",
|
|
307
|
+
languages: ["go", "ts"],
|
|
308
|
+
subject: "part",
|
|
309
|
+
holdsLive: false,
|
|
310
|
+
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.",
|
|
311
|
+
precondition: "In TypeScript the binding of a catch clause is a local variable the clause writes when it catches, so a binding that is a name and that the clause's block never reads is a dead store, positioned at the binding: the clause written with no binding behaves the same. A TypeScript local is a name a `let` or `const` declaration of a block binds, or a `var` declaration of a block of a function, a name an object or array binding pattern of one binds at any depth included, except a name with a default, whose removal skips the default's evaluation, and a name beside a rest element of its object pattern, whose removal changes what the rest holds. A function declaration of a block of a function is a TypeScript local too, written with its function when the block starts, wherever it stands in the block, so one that nothing outside its own body reads is a dead store positioned at its name, and a read anywhere else in the block reads it. A `let` or `var` declaration with no initializer writes `undefined`, so one that nothing reads and nothing writes is a dead store positioned at its name. A local whose declaration carries the type annotation `never` is no subject: a write to it is the compiler's exhaustiveness check, which fails to compile once a case goes unhandled, so deleting it changes what the program checks. A `var` of a block nested in its function's body is judged in that block, its last write kept because the function scope reads on past the block's end, and is no subject where a nested function of its function names it. A local a nested function reads is no subject, because the function may read it at any time, and every write to a local nothing reads is dead, one a nested function makes included, each positioned at the name it writes. The variable a `let` or `const` declaration of a `for…of` or `for…in` statement binds is written at each iteration, so one the loop body never reads is a dead store positioned at the binding, except a name that starts with an underscore, because a loop must bind a name and that spelling declares it unread. In Go a function literal a package-level variable's initializer holds is a function body of its own, and a finding about one of its stores carries the reference of the variable the literal initializes, which for a blank variable is its package's, as `grammar/symbol-ref.md` states for a blank-identifier declaration. In Go a range statement stores its key and its value at the start of every iteration, and an empty range stores neither. In Go a function literal reads each variable it names where it is written, and a store that a literal naming its variable may precede on some path of the control-flow graph, the literal of an earlier iteration of a loop included, is not dead, because a call of the literal the graph does not order may read it. A store no such literal precedes is judged as any other. A literal that is the callee of the call it is written in, outside a `go` or `defer` statement, runs there, so it reads its variables at that call and precedes no later store.",
|
|
312
|
+
details: { write_positions: "required", overlap: "required" },
|
|
313
|
+
defaultEnabled: true,
|
|
314
|
+
defaultSeverity: "deny",
|
|
315
|
+
maxClass: "certain",
|
|
316
|
+
fixability: "deletable",
|
|
317
|
+
overlap: {
|
|
318
|
+
go: ["ineffassign", "wastedassign", "staticcheck SA4006"],
|
|
319
|
+
ts: ["eslint no-useless-assignment", "@typescript-eslint/no-unused-vars"],
|
|
320
|
+
},
|
|
321
|
+
fixed: false,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
code: "DS1405",
|
|
325
|
+
name: "unreachable-statement",
|
|
326
|
+
languages: ["go", "ts"],
|
|
327
|
+
subject: "part",
|
|
328
|
+
holdsLive: false,
|
|
329
|
+
rule: "A statement that control flow cannot reach, at the precision the language's compiler applies to the same construct.",
|
|
330
|
+
details: { overlap: "required" },
|
|
331
|
+
defaultEnabled: true,
|
|
332
|
+
defaultSeverity: "deny",
|
|
333
|
+
maxClass: "certain",
|
|
334
|
+
fixability: "deletable",
|
|
335
|
+
overlap: {
|
|
336
|
+
go: ["go vet unreachable"],
|
|
337
|
+
ts: ["tsc allowUnreachableCode", "eslint no-unreachable"],
|
|
338
|
+
},
|
|
339
|
+
fixed: false,
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
code: "DS1406",
|
|
343
|
+
name: "unreachable-case",
|
|
344
|
+
languages: ["go", "ts"],
|
|
345
|
+
subject: "part",
|
|
346
|
+
holdsLive: false,
|
|
347
|
+
rule: "A switch case whose type or value an earlier case in the same switch already covers.",
|
|
348
|
+
details: { overlap: "required" },
|
|
349
|
+
defaultEnabled: true,
|
|
350
|
+
defaultSeverity: "deny",
|
|
351
|
+
maxClass: "certain",
|
|
352
|
+
fixability: "deletable",
|
|
353
|
+
overlap: { go: ["staticcheck SA4020"], ts: ["none known"] },
|
|
354
|
+
fixed: false,
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
code: "DS1501",
|
|
358
|
+
name: "unnecessary-export",
|
|
359
|
+
languages: ["go", "ts"],
|
|
360
|
+
subject: "declaration",
|
|
361
|
+
holdsLive: true,
|
|
362
|
+
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. Three subjects are excluded. An interface method is excluded because its exportedness is the contract of the interface that declares it. A struct field is excluded because an encoder reads it by name. A method that satisfies an interface some symbol uses as a type is excluded because it cannot be unexported without its type ceasing to satisfy that interface, and so is a method whose name and signature are those of a method of an exported interface type declared by a package outside the target that the import closure holds, because that interface fixes them whether or not the program converts the method's type to it. 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. A reference from a Go external test package, a test file whose package clause names its directory's package with the suffix _test, is a reference from outside the package, because that test builds as another package and needs the export.",
|
|
363
|
+
precondition: "Closed world only. A Go main package, and an internal/ directory tree for importers outside its parent, are closed worlds whatever the configuration declares, because no other program can import them, so this finding is reported there always. A published package is a closed world 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. A symbol the rule of DS1301 holds for is not reported under this code, whatever severity the configuration gives DS1301, because the write-only finding names the defect to fix first. A type that a parameter or a result of an exported function or method of its own package names is not reported when a reference from outside the package references that function or method, because the caller holds values of the type, and unexporting it would leave an exported signature naming a type its callers cannot name. A package-level declaration whose name a string literal spells carries the class grammar/analysis/confidence.md gives it.",
|
|
364
|
+
details: { narrower_visibility: "required", name_literal: "optional" },
|
|
365
|
+
defaultEnabled: true,
|
|
366
|
+
defaultSeverity: "warn",
|
|
367
|
+
maxClass: "certain",
|
|
368
|
+
fixability: "narrowable",
|
|
369
|
+
fixed: false,
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
code: "DS1502",
|
|
373
|
+
name: "unnecessary-exposure",
|
|
374
|
+
languages: ["go"],
|
|
375
|
+
subject: "declaration",
|
|
376
|
+
holdsLive: true,
|
|
377
|
+
rule: "An exported symbol of a non-internal package whose every reference is inside the target module, reported as a candidate for relocation behind an internal boundary. The subject is a package-level declaration or a method. Three subjects are excluded. An interface method is excluded because its exportedness is the contract of the interface that declares it. A struct field is excluded because an encoder reads it by name. A method that satisfies an interface some symbol uses as a type is excluded because it cannot be unexported without its type ceasing to satisfy that interface, and so is a method whose name and signature are those of a method of an exported interface type declared by a package outside the target that the import closure holds, because that interface fixes them whether or not the program converts the method's type to it. 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. A reference from a Go external test package, a test file whose package clause names its directory's package with the suffix _test, is a reference from outside the package, because that test builds as another package and needs the export.",
|
|
378
|
+
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. A symbol the rule of DS1301 holds for is not reported under this code, whatever severity the configuration gives DS1301, because the write-only finding names the defect to fix first. A type that a parameter or a result of an exported function or method of its own package names is not reported when a reference from outside the target module references that function or method, because the caller holds values of the type, and moving it behind an internal boundary would leave an exported signature naming a type its callers cannot name.",
|
|
379
|
+
details: { narrower_visibility: "required", name_literal: "optional" },
|
|
380
|
+
defaultEnabled: true,
|
|
381
|
+
defaultSeverity: "warn",
|
|
382
|
+
maxClass: "certain",
|
|
383
|
+
fixability: "narrowable",
|
|
384
|
+
fixed: false,
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
code: "DS1503",
|
|
388
|
+
name: "redundant-export-keyword",
|
|
389
|
+
languages: ["ts"],
|
|
390
|
+
subject: "declaration",
|
|
391
|
+
holdsLive: true,
|
|
392
|
+
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.",
|
|
393
|
+
precondition: 'Closed world only. Reported in a file that is not an entry file, a file only a configuration string or a script token names being none, because each runs the file and reads no name it exports, while a file a build script\'s bundler call names is one, because the bundle exposes what it exports, and a test file being one only for the exports its test runner calls, as grammar/analysis/tests.md "Test code" states, and a file a Markdown or MDX document imports one only for the exports the import reads, as grammar/analysis/roots.md "Markdown and MDX documents" states, 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. A symbol the rule of DS1301 holds for is not reported under this code, whatever severity the configuration gives DS1301, because the write-only finding names the defect to fix first.',
|
|
394
|
+
details: { narrower_visibility: "required" },
|
|
395
|
+
defaultEnabled: true,
|
|
396
|
+
defaultSeverity: "warn",
|
|
397
|
+
maxClass: "certain",
|
|
398
|
+
fixability: "narrowable",
|
|
399
|
+
fixed: false,
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
code: "DS1601",
|
|
403
|
+
name: "file-never-built",
|
|
404
|
+
languages: ["go", "ts"],
|
|
405
|
+
subject: "file",
|
|
406
|
+
holdsLive: false,
|
|
407
|
+
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 holds only when the ignore tag is set is never reported, because grammar/analysis/matrix.md keeps such a file outside the analysis wherever no configuration builds it: the tag is the toolchain's convention for a file kept out of ordinary package builds unless a configuration explicitly satisfies the tag, and built by hand, the toolchain applying no build constraint to a file named on its own command line. 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.",
|
|
408
|
+
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.',
|
|
409
|
+
details: { excluded_by: ["go"] },
|
|
410
|
+
defaultEnabled: true,
|
|
411
|
+
defaultSeverity: "deny",
|
|
412
|
+
maxClass: "certain",
|
|
413
|
+
fixability: "deletable",
|
|
414
|
+
fixed: false,
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
code: "DS1602",
|
|
418
|
+
name: "file-never-imported",
|
|
419
|
+
languages: ["go", "ts"],
|
|
420
|
+
subject: "file",
|
|
421
|
+
holdsLive: false,
|
|
422
|
+
rule: "A source file that no import from live code reaches, that no root names, and in which no declared cross-language edge names a declaration: an import counts where it is written in a file a root, a live declaration or such an import keeps, or in a live declaration, so a file only dead code imports is reported, under reachability. An import written in a loaded consumer reaches a file of the target as an import written in the target does. 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.",
|
|
423
|
+
details: {},
|
|
424
|
+
defaultEnabled: true,
|
|
425
|
+
defaultSeverity: "deny",
|
|
426
|
+
maxClass: "certain",
|
|
427
|
+
fixability: "deletable",
|
|
428
|
+
fixed: false,
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
code: "DS1701",
|
|
432
|
+
name: "unused-dependency",
|
|
433
|
+
languages: ["go", "ts"],
|
|
434
|
+
subject: "dependency",
|
|
435
|
+
holdsLive: false,
|
|
436
|
+
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. On the TypeScript side, a needed dependency whose every use is written inside declarations that are members of the run's dead components, or at the top level of a file reported under DS1602, that no command runs and that no needed dependency used otherwise names as a peer, is reported as well, dead only through that code: at the reachability class possible where one of those declarations belongs to a library's published API, and found under reachability alone where one of those declarations or files is, so at probable unless ts.roots_complete is true. A use the configuration makes, a use an unanswered specifier may make and an import none of whose bindings is used are uses by live code.",
|
|
437
|
+
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. On the TypeScript side the import closure is the files of the run's projects, and a call of `import.meta.resolve` or of `require.resolve` in them, whatever `require` names, whose first argument is a string literal or a template literal with no substitution needs each dependency an import of that specifier needs. A `@types/<name>` package in a type root of a compiler configuration that lists no `types`, a `node_modules/@types` directory at or above the configuration's directory or a `typeRoots` entry naming one, is needed by a use, in a file of that configuration, of a global name or an ambient module that one of the package's declaration files declares, which resolves to no declaration of the program: a compiler before version 6 includes every package of the type roots where `types` is not listed, and version 6 and later include none, so the program the analysis builds holds none of those declarations. A package's declaration files are the file its `types` or `typings` names, else its `index.d.ts`, and each file a `/// <reference path>` of one of them reaches inside the package. A global is a top-level declaration of such a file that is no module, or a declaration of a `declare global` block of one that is, and an ambient module is a `declare module` with a string name of a file that is no module. A name that names a member, a property or a label is no use of a global. Four more dependencies are needed: one whose command a script entry, a workflow step or a git hook runs, one that a string of a configuration file names, and one that a string names under a manifest key or a package key of an applied convention row, each as grammar/analysis/conventions.md states, and one that a needed dependency names as a peer, as stated below. A command no script entry, workflow step or git hook runs needs nothing. A declared dependency that the installed manifest of a needed declared dependency names in its peerDependencies is needed, and so on until no further dependency joins. A peer dependency is a package the needed dependency expects beside it at a version its manifest states, whether or not it imports the package, and the project's declaration is what keeps that package present at a version the project chooses, so removing the declaration can break the needed dependency where nothing the analysis reads imports the peer. A peer that peerDependenciesMeta marks optional is needed in the same way, because the needed dependency's manifest still names it as a package it works with, and a package manager may leave an optional peer out where the project does not declare it, so the project's declaration is what keeps it present for the needed dependency. A declared dependency that only dependencies nothing needs name as a peer is needed by nothing. A dependency of a manifest whose directory holds source only in configurations the run lists in configurations_not_built is reported at the reachability class possible, because the source that may import it was not analyzed. An installed manifest is the package's manifest in the nearest node_modules directory at or above the directory of the manifest that declares the dependency, and a dependency with none is decided by the import closure alone. On the TypeScript side, the dependencies judged are those of every manifest grammar/analysis/program.md says the analysis reads, a nested package's among them, each read against its own directory: a dependency is needed by a use written in a file at or below the directory of the manifest that declares it where no manifest between them declares a dependency of the same name, so a use below a nested manifest that declares the same dependency needs that nested manifest's declaration only, by a use no one file holds, and as a peer of a needed dependency of the same manifest or of a manifest below it. A dependency a nested package's manifest declares whose installed manifest the analysis cannot find is not judged, because no run requires a nested package to be installed and its commands and peers cannot be read, while a workspace member's and the target's own are judged as above.",
|
|
438
|
+
details: { dependency_class: "required" },
|
|
439
|
+
defaultEnabled: true,
|
|
440
|
+
defaultSeverity: "deny",
|
|
441
|
+
maxClass: "certain",
|
|
442
|
+
fixability: "manual",
|
|
443
|
+
fixed: false,
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
code: "DS1702",
|
|
447
|
+
name: "unused-module-directive",
|
|
448
|
+
languages: ["go"],
|
|
449
|
+
subject: "dependency",
|
|
450
|
+
holdsLive: false,
|
|
451
|
+
rule: "A replace directive whose target module is absent from the build list, the one case in which the directive is exactly a no-op.",
|
|
452
|
+
precondition: "Only a replace whose target is absent from the build list. No other module-file directive is reported. An exclude directive is not, because not selected is a counterfactual about a resolution that did not happen. A workspace use entry and a tool directive are not, because each is an external entry point whose invocation lives outside anything the analysis reads.",
|
|
453
|
+
details: { replacement: "required" },
|
|
454
|
+
defaultEnabled: true,
|
|
455
|
+
defaultSeverity: "warn",
|
|
456
|
+
maxClass: "certain",
|
|
457
|
+
fixability: "deletable",
|
|
458
|
+
fixed: false,
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
code: "DS9001",
|
|
462
|
+
name: "suppression-without-reason",
|
|
463
|
+
languages: ["go", "ts"],
|
|
464
|
+
subject: "record",
|
|
465
|
+
holdsLive: false,
|
|
466
|
+
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.",
|
|
467
|
+
details: { mechanism: "required", entry: "required" },
|
|
468
|
+
defaultEnabled: true,
|
|
469
|
+
defaultSeverity: "deny",
|
|
470
|
+
maxClass: "certain",
|
|
471
|
+
fixability: "none",
|
|
472
|
+
fixed: false,
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
code: "DS9002",
|
|
476
|
+
name: "unscoped-ignore-entry",
|
|
477
|
+
languages: ["go", "ts"],
|
|
478
|
+
subject: "record",
|
|
479
|
+
holdsLive: false,
|
|
480
|
+
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.",
|
|
481
|
+
details: { mechanism: "required", entry: "required" },
|
|
482
|
+
defaultEnabled: true,
|
|
483
|
+
defaultSeverity: "deny",
|
|
484
|
+
maxClass: "certain",
|
|
485
|
+
fixability: "none",
|
|
486
|
+
fixed: false,
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
code: "DS9003",
|
|
490
|
+
name: "stale-suppression",
|
|
491
|
+
languages: ["go", "ts"],
|
|
492
|
+
subject: "record",
|
|
493
|
+
holdsLive: false,
|
|
494
|
+
rule: "A suppression record that is stale, as grammar/suppression.md defines it, 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.",
|
|
495
|
+
details: { mechanism: "required", entry: "required" },
|
|
496
|
+
defaultEnabled: true,
|
|
497
|
+
defaultSeverity: "deny",
|
|
498
|
+
maxClass: "certain",
|
|
499
|
+
fixability: "none",
|
|
500
|
+
fixed: true,
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
code: "DS9004",
|
|
504
|
+
name: "unmatched-root",
|
|
505
|
+
languages: ["go", "ts"],
|
|
506
|
+
subject: "record",
|
|
507
|
+
holdsLive: false,
|
|
508
|
+
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.",
|
|
509
|
+
details: {},
|
|
510
|
+
defaultEnabled: true,
|
|
511
|
+
defaultSeverity: "deny",
|
|
512
|
+
maxClass: "certain",
|
|
513
|
+
fixability: "none",
|
|
514
|
+
fixed: true,
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
code: "DS9005",
|
|
518
|
+
name: "stale-cross-language-edge",
|
|
519
|
+
languages: ["go", "ts"],
|
|
520
|
+
subject: "record",
|
|
521
|
+
holdsLive: false,
|
|
522
|
+
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.",
|
|
523
|
+
details: { edge: "required", sides: "required" },
|
|
524
|
+
defaultEnabled: true,
|
|
525
|
+
defaultSeverity: "deny",
|
|
526
|
+
maxClass: "certain",
|
|
527
|
+
fixability: "none",
|
|
528
|
+
fixed: false,
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
code: "DS9006",
|
|
532
|
+
name: "unmatched-configured-declaration",
|
|
533
|
+
languages: ["ts"],
|
|
534
|
+
subject: "record",
|
|
535
|
+
holdsLive: false,
|
|
536
|
+
rule: "An entry of a configuration key that names a declaration, being an entry of ts.injection_registrations, of the components or the bases of an entry of ts.lifecycle_contracts, or of ts.serializers, that names no declaration in any project of the run, by the resolution the ts section of contract/config.schema.json states for its shape. An entry that names a declaration no call reaches matches. An exemption whose configured declarations nobody checks silently retains nothing, so a stale entry 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.",
|
|
537
|
+
details: {},
|
|
538
|
+
defaultEnabled: true,
|
|
539
|
+
defaultSeverity: "deny",
|
|
540
|
+
maxClass: "certain",
|
|
541
|
+
fixability: "none",
|
|
542
|
+
fixed: true,
|
|
543
|
+
},
|
|
544
|
+
];
|
|
545
|
+
export const CODE = {
|
|
546
|
+
unusedExported: "DS1001",
|
|
547
|
+
unusedUnexported: "DS1002",
|
|
548
|
+
unusedMember: "DS1003",
|
|
549
|
+
unusedImport: "DS1004",
|
|
550
|
+
unusedEnumMember: "DS1005",
|
|
551
|
+
unusedTypeParameter: "DS1006",
|
|
552
|
+
unreachableExport: "DS1101",
|
|
553
|
+
testOnlyUse: "DS1102",
|
|
554
|
+
testOfDeadCode: "DS1103",
|
|
555
|
+
deprecatedUnused: "DS1104",
|
|
556
|
+
unusedInterface: "DS1201",
|
|
557
|
+
uncalledInterfaceMethod: "DS1202",
|
|
558
|
+
unusedSatisfactionAssertion: "DS1203",
|
|
559
|
+
writeOnlySymbol: "DS1301",
|
|
560
|
+
unusedParameter: "DS1401",
|
|
561
|
+
unusedReceiver: "DS1402",
|
|
562
|
+
unusedResult: "DS1403",
|
|
563
|
+
deadStore: "DS1404",
|
|
564
|
+
unreachableStatement: "DS1405",
|
|
565
|
+
unreachableCase: "DS1406",
|
|
566
|
+
unnecessaryExport: "DS1501",
|
|
567
|
+
unnecessaryExposure: "DS1502",
|
|
568
|
+
redundantExportKeyword: "DS1503",
|
|
569
|
+
fileNeverBuilt: "DS1601",
|
|
570
|
+
fileNeverImported: "DS1602",
|
|
571
|
+
unusedDependency: "DS1701",
|
|
572
|
+
unusedModuleDirective: "DS1702",
|
|
573
|
+
suppressionWithoutReason: "DS9001",
|
|
574
|
+
unscopedIgnoreEntry: "DS9002",
|
|
575
|
+
staleSuppression: "DS9003",
|
|
576
|
+
unmatchedRoot: "DS9004",
|
|
577
|
+
staleCrossLanguageEdge: "DS9005",
|
|
578
|
+
unmatchedConfiguredDeclaration: "DS9006",
|
|
579
|
+
};
|
|
580
|
+
export const FAMILIES = [
|
|
581
|
+
{ key: "DS10", name: "unused", title: "Unused", status: "live" },
|
|
582
|
+
{
|
|
583
|
+
key: "DS11",
|
|
584
|
+
name: "dead-or-test-only",
|
|
585
|
+
title: "Only dead code or tests use it",
|
|
586
|
+
status: "live",
|
|
587
|
+
},
|
|
588
|
+
{ key: "DS12", name: "interfaces", title: "Interfaces", status: "live" },
|
|
589
|
+
{ key: "DS13", name: "unread-data", title: "Data nobody reads", status: "live" },
|
|
590
|
+
{ key: "DS14", name: "inside-functions", title: "Inside functions", status: "live" },
|
|
591
|
+
{ key: "DS15", name: "too-visible", title: "Too visible", status: "live" },
|
|
592
|
+
{ key: "DS16", name: "files", title: "Files", status: "live" },
|
|
593
|
+
{ key: "DS17", name: "dependencies", title: "Dependencies and module files", status: "live" },
|
|
594
|
+
{ key: "DS18", name: "schemas", title: "Schemas", status: "reserved" },
|
|
595
|
+
{ key: "DS90", name: "configuration", title: "deadset configuration", status: "live" },
|
|
596
|
+
];
|
|
597
|
+
export const SYMBOL_SUBJECTS = {
|
|
598
|
+
function: "declaration",
|
|
599
|
+
method: "declaration",
|
|
600
|
+
type: "declaration",
|
|
601
|
+
class: "declaration",
|
|
602
|
+
interface: "declaration",
|
|
603
|
+
enum: "declaration",
|
|
604
|
+
namespace: "declaration",
|
|
605
|
+
variable: "declaration",
|
|
606
|
+
constant: "declaration",
|
|
607
|
+
"export-alias": "declaration",
|
|
608
|
+
field: "declaration",
|
|
609
|
+
"class-member": "declaration",
|
|
610
|
+
"type-member": "declaration",
|
|
611
|
+
"interface-method": "declaration",
|
|
612
|
+
"enum-member": "declaration",
|
|
613
|
+
"satisfaction-assertion": "declaration",
|
|
614
|
+
"type-parameter": "declaration",
|
|
615
|
+
parameter: "part",
|
|
616
|
+
receiver: "part",
|
|
617
|
+
result: "part",
|
|
618
|
+
statement: "part",
|
|
619
|
+
case: "part",
|
|
620
|
+
store: "part",
|
|
621
|
+
file: "file",
|
|
622
|
+
import: "binding",
|
|
623
|
+
dependency: "dependency",
|
|
624
|
+
"module-directive": "dependency",
|
|
625
|
+
suppression: "record",
|
|
626
|
+
root: "record",
|
|
627
|
+
"configured-declaration": "record",
|
|
628
|
+
edge: "record",
|
|
629
|
+
};
|
|
630
|
+
export const EXEMPTION_CLASSES = [
|
|
631
|
+
{
|
|
632
|
+
class: "interface-satisfaction",
|
|
633
|
+
languages: ["go", "ts"],
|
|
634
|
+
confidence: "certain",
|
|
635
|
+
retainsKinds: { go: ["method", "field"], ts: ["method", "class-member"] },
|
|
636
|
+
typescriptVisibility: { private: false, privateName: false },
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
class: "encoding-reflection",
|
|
640
|
+
languages: ["go"],
|
|
641
|
+
confidence: "certain",
|
|
642
|
+
retainsKinds: { go: ["field", "method"] },
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
class: "format-verb-contract",
|
|
646
|
+
languages: ["go"],
|
|
647
|
+
confidence: "certain",
|
|
648
|
+
retainsKinds: { go: ["method"] },
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
class: "errors-duck-typing",
|
|
652
|
+
languages: ["go"],
|
|
653
|
+
confidence: "certain",
|
|
654
|
+
retainsKinds: { go: ["method"] },
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
class: "enum-group",
|
|
658
|
+
languages: ["go", "ts"],
|
|
659
|
+
confidence: "certain",
|
|
660
|
+
retainsKinds: { go: ["enum-member"], ts: ["enum-member"] },
|
|
661
|
+
typescriptVisibility: { private: false, privateName: false },
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
class: "generated-file",
|
|
665
|
+
languages: ["go", "ts"],
|
|
666
|
+
confidence: "certain",
|
|
667
|
+
retainsKinds: {
|
|
668
|
+
go: [
|
|
669
|
+
"function",
|
|
670
|
+
"method",
|
|
671
|
+
"type",
|
|
672
|
+
"interface",
|
|
673
|
+
"variable",
|
|
674
|
+
"constant",
|
|
675
|
+
"field",
|
|
676
|
+
"interface-method",
|
|
677
|
+
"enum-member",
|
|
678
|
+
"satisfaction-assertion",
|
|
679
|
+
"type-parameter",
|
|
680
|
+
],
|
|
681
|
+
ts: [
|
|
682
|
+
"function",
|
|
683
|
+
"method",
|
|
684
|
+
"type",
|
|
685
|
+
"class",
|
|
686
|
+
"interface",
|
|
687
|
+
"enum",
|
|
688
|
+
"namespace",
|
|
689
|
+
"variable",
|
|
690
|
+
"export-alias",
|
|
691
|
+
"import",
|
|
692
|
+
"class-member",
|
|
693
|
+
"type-member",
|
|
694
|
+
"interface-method",
|
|
695
|
+
"enum-member",
|
|
696
|
+
"type-parameter",
|
|
697
|
+
],
|
|
698
|
+
},
|
|
699
|
+
typescriptVisibility: { private: true, privateName: false },
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
class: "linkname-cgo-asm-plugin",
|
|
703
|
+
languages: ["go"],
|
|
704
|
+
confidence: "certain",
|
|
705
|
+
retainsKinds: { go: ["function", "variable"] },
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
class: "template-field",
|
|
709
|
+
languages: ["go", "ts"],
|
|
710
|
+
confidence: "possible",
|
|
711
|
+
retainsKinds: {
|
|
712
|
+
go: ["field", "method"],
|
|
713
|
+
ts: [
|
|
714
|
+
"function",
|
|
715
|
+
"method",
|
|
716
|
+
"type",
|
|
717
|
+
"class",
|
|
718
|
+
"interface",
|
|
719
|
+
"enum",
|
|
720
|
+
"namespace",
|
|
721
|
+
"variable",
|
|
722
|
+
"export-alias",
|
|
723
|
+
"import",
|
|
724
|
+
"class-member",
|
|
725
|
+
"type-member",
|
|
726
|
+
"interface-method",
|
|
727
|
+
"enum-member",
|
|
728
|
+
"type-parameter",
|
|
729
|
+
],
|
|
730
|
+
},
|
|
731
|
+
typescriptVisibility: { private: true, privateName: false },
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
class: "reflective-lookup",
|
|
735
|
+
languages: ["go", "ts"],
|
|
736
|
+
confidence: "possible",
|
|
737
|
+
retainsKinds: {
|
|
738
|
+
go: ["field", "method"],
|
|
739
|
+
ts: [
|
|
740
|
+
"function",
|
|
741
|
+
"method",
|
|
742
|
+
"type",
|
|
743
|
+
"class",
|
|
744
|
+
"interface",
|
|
745
|
+
"enum",
|
|
746
|
+
"namespace",
|
|
747
|
+
"variable",
|
|
748
|
+
"export-alias",
|
|
749
|
+
"import",
|
|
750
|
+
"class-member",
|
|
751
|
+
"type-member",
|
|
752
|
+
"interface-method",
|
|
753
|
+
"enum-member",
|
|
754
|
+
"type-parameter",
|
|
755
|
+
],
|
|
756
|
+
},
|
|
757
|
+
typescriptVisibility: { private: true, privateName: false },
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
class: "decorator",
|
|
761
|
+
languages: ["ts"],
|
|
762
|
+
confidence: "certain",
|
|
763
|
+
retainsKinds: {
|
|
764
|
+
ts: [
|
|
765
|
+
"function",
|
|
766
|
+
"method",
|
|
767
|
+
"type",
|
|
768
|
+
"class",
|
|
769
|
+
"interface",
|
|
770
|
+
"enum",
|
|
771
|
+
"namespace",
|
|
772
|
+
"variable",
|
|
773
|
+
"export-alias",
|
|
774
|
+
"import",
|
|
775
|
+
"class-member",
|
|
776
|
+
"type-member",
|
|
777
|
+
"interface-method",
|
|
778
|
+
"enum-member",
|
|
779
|
+
"type-parameter",
|
|
780
|
+
],
|
|
781
|
+
},
|
|
782
|
+
typescriptVisibility: { private: true, privateName: false },
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
class: "injection-container",
|
|
786
|
+
languages: ["ts"],
|
|
787
|
+
confidence: "certain",
|
|
788
|
+
retainsKinds: { ts: ["method", "class-member"] },
|
|
789
|
+
typescriptVisibility: { private: true, privateName: false },
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
class: "framework-lifecycle",
|
|
793
|
+
languages: ["ts"],
|
|
794
|
+
confidence: "certain",
|
|
795
|
+
retainsKinds: { ts: ["method", "class-member"] },
|
|
796
|
+
typescriptVisibility: { private: true, privateName: false },
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
class: "serialization-contract",
|
|
800
|
+
languages: ["ts"],
|
|
801
|
+
confidence: "certain",
|
|
802
|
+
retainsKinds: { ts: ["method", "class-member", "interface-method", "type-member"] },
|
|
803
|
+
typescriptVisibility: { private: true, privateName: false },
|
|
804
|
+
},
|
|
805
|
+
];
|
|
806
|
+
export const EVIDENCE = [
|
|
807
|
+
{
|
|
808
|
+
evidence: "consumers-not-loaded",
|
|
809
|
+
rule: "confidence.2",
|
|
810
|
+
class: "probable",
|
|
811
|
+
languages: ["go", "ts"],
|
|
812
|
+
codes: [
|
|
813
|
+
"DS1001",
|
|
814
|
+
"DS1002",
|
|
815
|
+
"DS1003",
|
|
816
|
+
"DS1004",
|
|
817
|
+
"DS1005",
|
|
818
|
+
"DS1006",
|
|
819
|
+
"DS1101",
|
|
820
|
+
"DS1102",
|
|
821
|
+
"DS1103",
|
|
822
|
+
"DS1104",
|
|
823
|
+
"DS1201",
|
|
824
|
+
"DS1202",
|
|
825
|
+
"DS1203",
|
|
826
|
+
"DS1301",
|
|
827
|
+
"DS1501",
|
|
828
|
+
"DS1502",
|
|
829
|
+
"DS1503",
|
|
830
|
+
],
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
evidence: "no-consumer-information",
|
|
834
|
+
rule: "confidence.2",
|
|
835
|
+
class: "possible",
|
|
836
|
+
languages: ["go", "ts"],
|
|
837
|
+
codes: [
|
|
838
|
+
"DS1001",
|
|
839
|
+
"DS1002",
|
|
840
|
+
"DS1003",
|
|
841
|
+
"DS1004",
|
|
842
|
+
"DS1005",
|
|
843
|
+
"DS1006",
|
|
844
|
+
"DS1101",
|
|
845
|
+
"DS1102",
|
|
846
|
+
"DS1103",
|
|
847
|
+
"DS1104",
|
|
848
|
+
"DS1201",
|
|
849
|
+
"DS1202",
|
|
850
|
+
"DS1203",
|
|
851
|
+
"DS1301",
|
|
852
|
+
"DS1501",
|
|
853
|
+
"DS1502",
|
|
854
|
+
"DS1503",
|
|
855
|
+
],
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
evidence: "unlinked-go-package",
|
|
859
|
+
rule: "roots.25",
|
|
860
|
+
class: "possible",
|
|
861
|
+
languages: ["go"],
|
|
862
|
+
codes: [
|
|
863
|
+
"DS1001",
|
|
864
|
+
"DS1002",
|
|
865
|
+
"DS1003",
|
|
866
|
+
"DS1004",
|
|
867
|
+
"DS1005",
|
|
868
|
+
"DS1006",
|
|
869
|
+
"DS1101",
|
|
870
|
+
"DS1102",
|
|
871
|
+
"DS1103",
|
|
872
|
+
"DS1104",
|
|
873
|
+
"DS1201",
|
|
874
|
+
"DS1202",
|
|
875
|
+
"DS1203",
|
|
876
|
+
"DS1301",
|
|
877
|
+
"DS1501",
|
|
878
|
+
"DS1502",
|
|
879
|
+
"DS1503",
|
|
880
|
+
],
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
evidence: "name-literal",
|
|
884
|
+
rule: "confidence.8",
|
|
885
|
+
class: "possible",
|
|
886
|
+
languages: ["go"],
|
|
887
|
+
codes: ["DS1001", "DS1002", "DS1101", "DS1102", "DS1104", "DS1501", "DS1502"],
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
evidence: "in-operand",
|
|
891
|
+
rule: "confidence.13",
|
|
892
|
+
class: "possible",
|
|
893
|
+
languages: ["ts"],
|
|
894
|
+
codes: [
|
|
895
|
+
"DS1001",
|
|
896
|
+
"DS1002",
|
|
897
|
+
"DS1003",
|
|
898
|
+
"DS1004",
|
|
899
|
+
"DS1005",
|
|
900
|
+
"DS1006",
|
|
901
|
+
"DS1101",
|
|
902
|
+
"DS1102",
|
|
903
|
+
"DS1103",
|
|
904
|
+
"DS1104",
|
|
905
|
+
"DS1201",
|
|
906
|
+
"DS1202",
|
|
907
|
+
"DS1203",
|
|
908
|
+
"DS1301",
|
|
909
|
+
"DS1501",
|
|
910
|
+
"DS1502",
|
|
911
|
+
"DS1503",
|
|
912
|
+
],
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
evidence: "outside-filler",
|
|
916
|
+
rule: "confidence.14",
|
|
917
|
+
class: "possible",
|
|
918
|
+
languages: ["go"],
|
|
919
|
+
codes: [
|
|
920
|
+
"DS1001",
|
|
921
|
+
"DS1002",
|
|
922
|
+
"DS1003",
|
|
923
|
+
"DS1004",
|
|
924
|
+
"DS1005",
|
|
925
|
+
"DS1006",
|
|
926
|
+
"DS1101",
|
|
927
|
+
"DS1102",
|
|
928
|
+
"DS1103",
|
|
929
|
+
"DS1104",
|
|
930
|
+
"DS1201",
|
|
931
|
+
"DS1202",
|
|
932
|
+
"DS1203",
|
|
933
|
+
"DS1301",
|
|
934
|
+
"DS1501",
|
|
935
|
+
"DS1502",
|
|
936
|
+
"DS1503",
|
|
937
|
+
],
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
evidence: "decoded-outside",
|
|
941
|
+
rule: "confidence.19",
|
|
942
|
+
class: "possible",
|
|
943
|
+
languages: ["go", "ts"],
|
|
944
|
+
codes: [
|
|
945
|
+
"DS1001",
|
|
946
|
+
"DS1002",
|
|
947
|
+
"DS1003",
|
|
948
|
+
"DS1004",
|
|
949
|
+
"DS1005",
|
|
950
|
+
"DS1006",
|
|
951
|
+
"DS1101",
|
|
952
|
+
"DS1102",
|
|
953
|
+
"DS1103",
|
|
954
|
+
"DS1104",
|
|
955
|
+
"DS1201",
|
|
956
|
+
"DS1202",
|
|
957
|
+
"DS1203",
|
|
958
|
+
"DS1301",
|
|
959
|
+
"DS1501",
|
|
960
|
+
"DS1502",
|
|
961
|
+
"DS1503",
|
|
962
|
+
],
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
evidence: "test-reached",
|
|
966
|
+
rule: "confidence.20",
|
|
967
|
+
class: "possible",
|
|
968
|
+
languages: ["ts"],
|
|
969
|
+
codes: [
|
|
970
|
+
"DS1001",
|
|
971
|
+
"DS1002",
|
|
972
|
+
"DS1003",
|
|
973
|
+
"DS1004",
|
|
974
|
+
"DS1005",
|
|
975
|
+
"DS1006",
|
|
976
|
+
"DS1101",
|
|
977
|
+
"DS1102",
|
|
978
|
+
"DS1103",
|
|
979
|
+
"DS1104",
|
|
980
|
+
"DS1201",
|
|
981
|
+
"DS1202",
|
|
982
|
+
"DS1203",
|
|
983
|
+
"DS1301",
|
|
984
|
+
"DS1501",
|
|
985
|
+
"DS1502",
|
|
986
|
+
"DS1503",
|
|
987
|
+
"DS1602",
|
|
988
|
+
],
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
evidence: "test-reached",
|
|
992
|
+
rule: "confidence.21",
|
|
993
|
+
class: "possible",
|
|
994
|
+
languages: ["go"],
|
|
995
|
+
codes: ["DS1001", "DS1002", "DS1003", "DS1102", "DS1103", "DS1104", "DS1201", "DS1301"],
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
evidence: "possible-class",
|
|
999
|
+
rule: "confidence.23",
|
|
1000
|
+
class: "possible",
|
|
1001
|
+
languages: ["go", "ts"],
|
|
1002
|
+
codes: [
|
|
1003
|
+
"DS1001",
|
|
1004
|
+
"DS1002",
|
|
1005
|
+
"DS1003",
|
|
1006
|
+
"DS1004",
|
|
1007
|
+
"DS1005",
|
|
1008
|
+
"DS1006",
|
|
1009
|
+
"DS1101",
|
|
1010
|
+
"DS1102",
|
|
1011
|
+
"DS1103",
|
|
1012
|
+
"DS1104",
|
|
1013
|
+
"DS1201",
|
|
1014
|
+
"DS1202",
|
|
1015
|
+
"DS1203",
|
|
1016
|
+
"DS1301",
|
|
1017
|
+
"DS1501",
|
|
1018
|
+
"DS1502",
|
|
1019
|
+
"DS1503",
|
|
1020
|
+
],
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
evidence: "roots-incomplete",
|
|
1024
|
+
rule: "confidence.25",
|
|
1025
|
+
class: "probable",
|
|
1026
|
+
languages: ["ts"],
|
|
1027
|
+
codes: [
|
|
1028
|
+
"DS1001",
|
|
1029
|
+
"DS1002",
|
|
1030
|
+
"DS1003",
|
|
1031
|
+
"DS1004",
|
|
1032
|
+
"DS1005",
|
|
1033
|
+
"DS1006",
|
|
1034
|
+
"DS1101",
|
|
1035
|
+
"DS1102",
|
|
1036
|
+
"DS1103",
|
|
1037
|
+
"DS1104",
|
|
1038
|
+
"DS1201",
|
|
1039
|
+
"DS1202",
|
|
1040
|
+
"DS1203",
|
|
1041
|
+
"DS1301",
|
|
1042
|
+
"DS1501",
|
|
1043
|
+
"DS1502",
|
|
1044
|
+
"DS1503",
|
|
1045
|
+
"DS1602",
|
|
1046
|
+
],
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
evidence: "computed-load",
|
|
1050
|
+
rule: "confidence.26",
|
|
1051
|
+
class: "probable",
|
|
1052
|
+
languages: ["ts"],
|
|
1053
|
+
codes: [
|
|
1054
|
+
"DS1001",
|
|
1055
|
+
"DS1002",
|
|
1056
|
+
"DS1003",
|
|
1057
|
+
"DS1004",
|
|
1058
|
+
"DS1005",
|
|
1059
|
+
"DS1006",
|
|
1060
|
+
"DS1101",
|
|
1061
|
+
"DS1102",
|
|
1062
|
+
"DS1103",
|
|
1063
|
+
"DS1104",
|
|
1064
|
+
"DS1201",
|
|
1065
|
+
"DS1202",
|
|
1066
|
+
"DS1203",
|
|
1067
|
+
"DS1301",
|
|
1068
|
+
"DS1501",
|
|
1069
|
+
"DS1502",
|
|
1070
|
+
"DS1503",
|
|
1071
|
+
"DS1602",
|
|
1072
|
+
],
|
|
1073
|
+
},
|
|
1074
|
+
];
|
|
1075
|
+
export const SETUP_CLASSES = [
|
|
1076
|
+
{ class: "missing-module", languages: ["go", "ts"] },
|
|
1077
|
+
{ class: "incomplete-module-sum", languages: ["go"] },
|
|
1078
|
+
{ class: "missing-consumer", languages: ["go", "ts"] },
|
|
1079
|
+
{ class: "workspace-member-without-source", languages: ["ts"] },
|
|
1080
|
+
{ class: "convention-not-literal", languages: ["ts"] },
|
|
1081
|
+
{ class: "no-program", languages: ["go", "ts"] },
|
|
1082
|
+
];
|
|
1083
|
+
/** The text opening the line of the error stream that names one setup failure. */
|
|
1084
|
+
export const SETUP_FAILURE_PREFIX = "setup failure: ";
|