@cplieger/deadset-ts 3.12.1 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/src/analysis.js +100 -27
- package/dist/src/components.js +4 -2
- package/dist/src/configured-declarations.js +36 -0
- package/dist/src/conformance-record.js +2 -2
- package/dist/src/edges.js +4 -1
- package/dist/src/findings/completion.js +37 -8
- package/dist/src/findings/emitters.js +5 -5
- package/dist/src/findings/intra-function.js +91 -2
- package/dist/src/findings/self-check.js +30 -7
- package/dist/src/findings/unused-declarations.js +15 -3
- package/dist/src/findings-pass.js +18 -11
- package/dist/src/intra-function-parts.js +643 -0
- package/dist/src/kinds.js +337 -35
- package/dist/src/reflective-lookup.js +35 -2
- package/dist/src/report.js +11 -2
- package/dist/src/reporters/sarif.js +20 -15
- package/dist/src/reporters/template.js +64 -5
- package/dist/src/serialization-contract.js +41 -22
- package/dist/src/signatures.js +32 -0
- package/dist/src/suppress-file.js +27 -6
- package/dist/src/suppress-inline.js +8 -1
- package/dist/src/suppress.js +27 -0
- package/dist/src/value-reach.js +33 -9
- package/dist/src/verbs/analyze.js +19 -11
- package/dist/src/verbs/describe.js +12 -8
- package/dist/src/version.js +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/analysis.ts +167 -48
- package/src/components.ts +4 -2
- package/src/configured-declarations.ts +57 -1
- package/src/conformance-record.ts +2 -2
- package/src/edges.ts +4 -1
- package/src/finding.ts +5 -1
- package/src/findings/completion.ts +46 -10
- package/src/findings/emitter.ts +3 -0
- package/src/findings/emitters.ts +9 -5
- package/src/findings/intra-function.ts +106 -3
- package/src/findings/self-check.ts +48 -7
- package/src/findings/unused-declarations.ts +18 -4
- package/src/findings-pass.ts +26 -11
- package/src/intra-function-parts.ts +871 -0
- package/src/kinds.ts +355 -41
- package/src/reflective-lookup.ts +42 -2
- package/src/report.ts +18 -2
- package/src/reporters/sarif.ts +24 -16
- package/src/reporters/template.ts +69 -6
- package/src/serialization-contract.ts +47 -30
- package/src/signatures.ts +55 -0
- package/src/suppress-file.ts +34 -6
- package/src/suppress-inline.ts +8 -1
- package/src/suppress.ts +31 -0
- package/src/value-reach.ts +53 -12
- package/src/verbs/analyze.ts +26 -11
- package/src/verbs/describe.ts +13 -9
- package/src/version.ts +1 -1
- package/dist/src/reporters/rules.js +0 -178
- package/src/reporters/rules.ts +0 -195
|
@@ -111,7 +111,15 @@ function messageOf(code, judged) {
|
|
|
111
111
|
return `${subject} has no reference in the target`;
|
|
112
112
|
}
|
|
113
113
|
/** The findings of the unused-declarations family, `DS1000` to `DS1099`. */
|
|
114
|
-
export const unusedDeclarations = (input) =>
|
|
114
|
+
export const unusedDeclarations = (input) => familyFindings(input, false);
|
|
115
|
+
/**
|
|
116
|
+
* The finding each member of a dead container would carry were its container live: what
|
|
117
|
+
* a record on such a member is matched against, since the report carries the container's
|
|
118
|
+
* finding rather than one of the member's own.
|
|
119
|
+
*/
|
|
120
|
+
export const fallenMembers = (input) => familyFindings(input, true);
|
|
121
|
+
/** The family's findings, or, where `fallen` is set, its dead containers' members' alone. */
|
|
122
|
+
function familyFindings(input, fallen) {
|
|
115
123
|
const union = input.swept.matrix.union;
|
|
116
124
|
const dead = new Set(input.swept.sweep.candidates.map((candidate) => candidate.id));
|
|
117
125
|
const unreachable = unreachableExports(input);
|
|
@@ -122,11 +130,15 @@ export const unusedDeclarations = (input) => {
|
|
|
122
130
|
if (symbol === undefined) {
|
|
123
131
|
continue;
|
|
124
132
|
}
|
|
133
|
+
const containerDead = dead.has(symbol.parent);
|
|
134
|
+
if (fallen !== containerDead) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
125
137
|
const judged = {
|
|
126
138
|
candidate,
|
|
127
139
|
symbol,
|
|
128
140
|
test: union.test[at] === true,
|
|
129
|
-
containerDead:
|
|
141
|
+
containerDead: containerDead && !fallen,
|
|
130
142
|
deprecated: input.deprecated.has(symbol.id),
|
|
131
143
|
unreachable: unreachable.has(symbol.id),
|
|
132
144
|
};
|
|
@@ -148,4 +160,4 @@ export const unusedDeclarations = (input) => {
|
|
|
148
160
|
});
|
|
149
161
|
}
|
|
150
162
|
return found;
|
|
151
|
-
}
|
|
163
|
+
}
|
|
@@ -76,18 +76,25 @@ export function verdictOf(result, config) {
|
|
|
76
76
|
return failing ? EXIT_FINDINGS : EXIT_CLEAN;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* The
|
|
80
|
-
* row of a document is not recorded: no record withholds one, so a row
|
|
81
|
-
* be stale on the first read back.
|
|
79
|
+
* The rows one round of a baseline write records from its findings, in their order. A
|
|
80
|
+
* finding about a row of a document is not recorded: no record withholds one, so a row
|
|
81
|
+
* recording it would be stale on the first read back. Two findings that would record the
|
|
82
|
+
* same row, two parts of one declaration under one code, record it once.
|
|
82
83
|
*/
|
|
83
|
-
export function recordedFindings(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
path: finding.position.path
|
|
90
|
-
|
|
84
|
+
export function recordedFindings(findings) {
|
|
85
|
+
const rows = new Map();
|
|
86
|
+
for (const finding of findings) {
|
|
87
|
+
if (isRowSubject(finding.symbol.kind)) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const row = { code: finding.code, symbol: finding.symbol.ref, path: finding.position.path };
|
|
91
|
+
rows.set(rowKey(row), rows.get(rowKey(row)) ?? row);
|
|
92
|
+
}
|
|
93
|
+
return [...rows.values()];
|
|
94
|
+
}
|
|
95
|
+
/** One row's identity: its code, its symbol and its path. */
|
|
96
|
+
export function rowKey(row) {
|
|
97
|
+
return `${row.code}\u0000${row.symbol}\u0000${row.path}`;
|
|
91
98
|
}
|
|
92
99
|
/** The analyzer identity a baseline this analyzer writes names as its rows' provenance. */
|
|
93
100
|
export function analyzerProvenance(version) {
|