@cplieger/deadset-ts 8.0.0-dev.5 → 8.0.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/analysis.js +3 -3
- package/dist/src/config.js +1 -1
- package/dist/src/conformance-record.js +1 -1
- package/dist/src/contract/contract.generated.js +1071 -0
- package/dist/src/contract/report.generated.js +796 -0
- package/dist/src/exempt-classes.js +1 -59
- package/dist/src/exempt.js +8 -19
- 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 +9 -8
- package/dist/src/findings/self-check.js +7 -10
- package/dist/src/findings/unused-declarations.js +28 -27
- package/dist/src/findings/visibility-narrowing.js +9 -11
- package/dist/src/findings-pass.js +1 -3
- package/dist/src/index.js +1 -1
- package/dist/src/intra-function-parts.js +8 -13
- package/dist/src/kinds.js +4 -360
- package/dist/src/report-schema.js +273 -0
- package/dist/src/report.js +17 -11
- package/dist/src/resolve.js +1 -6
- package/dist/src/run.js +2 -1
- package/dist/src/setup-failure.js +2 -6
- package/dist/src/suppress-file.js +4 -3
- package/dist/src/suppress-inline.js +3 -2
- package/dist/src/suppress.js +29 -48
- package/dist/src/verbs/analyze.js +7 -2
- package/dist/src/verbs/describe.js +4 -4
- package/dist/src/verbs/explain.js +2 -1
- package/dist/src/verbs/print-config.js +2 -1
- package/dist/src/verbs/print-projects.js +2 -1
- package/dist/src/verbs/print-retained.js +2 -1
- package/dist/src/verbs/print-roots.js +2 -1
- package/dist/src/verbs/verb.js +1 -5
- package/dist/src/verbs/version.js +2 -2
- package/jsr.json +1 -1
- package/package.json +2 -1
- package/src/analysis.ts +3 -3
- package/src/config.ts +7 -13
- package/src/conformance-record.ts +1 -1
- package/src/contract/contract.generated.ts +1123 -0
- package/src/contract/report.generated.ts +1157 -0
- package/src/exempt-classes.ts +1 -70
- package/src/exempt.ts +12 -20
- 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 +13 -11
- package/src/findings/self-check.ts +8 -15
- package/src/findings/unused-declarations.ts +28 -27
- package/src/findings/visibility-narrowing.ts +9 -12
- package/src/findings-pass.ts +1 -4
- package/src/index.ts +1 -1
- package/src/intra-function-parts.ts +8 -14
- package/src/kinds.ts +6 -406
- package/src/report-schema.ts +366 -0
- package/src/report.ts +42 -195
- 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 +13 -8
- package/src/reporters/text.ts +3 -3
- package/src/resolve.ts +11 -11
- package/src/run.ts +2 -1
- package/src/setup-failure.ts +5 -7
- package/src/suppress-file.ts +3 -4
- package/src/suppress-inline.ts +2 -2
- package/src/suppress.ts +39 -55
- package/src/verbs/analyze.ts +16 -4
- package/src/verbs/describe.ts +10 -4
- package/src/verbs/explain.ts +2 -1
- package/src/verbs/print-config.ts +2 -1
- package/src/verbs/print-projects.ts +2 -1
- package/src/verbs/print-retained.ts +2 -1
- package/src/verbs/print-roots.ts +2 -1
- package/src/verbs/verb.ts +0 -6
- package/src/verbs/version.ts +2 -2
- package/dist/src/version.js +0 -7
- package/src/version.ts +0 -7
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { EXIT_CLEAN } from "../contract/contract.generated.js";
|
|
1
2
|
import { runProjects } from "../analysis.js";
|
|
2
3
|
import { partialNotes } from "../partial.js";
|
|
3
4
|
import { resolvePath } from "../paths.js";
|
|
4
5
|
import { resolveUnkinded } from "../resolve.js";
|
|
5
|
-
import {
|
|
6
|
+
import {} from "./verb.js";
|
|
6
7
|
/**
|
|
7
8
|
* Writes the name of every project one run analyzes, one per line: the identifier the
|
|
8
9
|
* build matrix declares for it, or, where discovery derived the project, its
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { EXIT_CLEAN } from "../contract/contract.generated.js";
|
|
1
2
|
import { runSweep } from "../analysis.js";
|
|
2
3
|
import { retainedLines } from "../exempt.js";
|
|
3
4
|
import { partialNotes } from "../partial.js";
|
|
4
5
|
import { resolvePath } from "../paths.js";
|
|
5
6
|
import { resolve } from "../resolve.js";
|
|
6
|
-
import {
|
|
7
|
+
import {} from "./verb.js";
|
|
7
8
|
/**
|
|
8
9
|
* Writes every declaration an exemption held back in the production sweep a report is
|
|
9
10
|
* built from, one per line, and nothing where no exemption held one back. One fact
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { EXIT_CLEAN, EXIT_FINDINGS } from "../contract/contract.generated.js";
|
|
1
2
|
import { runRoots } from "../analysis.js";
|
|
2
3
|
import { partialNotes } from "../partial.js";
|
|
3
4
|
import { resolvePath } from "../paths.js";
|
|
4
5
|
import { resolve } from "../resolve.js";
|
|
5
|
-
import {
|
|
6
|
+
import {} from "./verb.js";
|
|
6
7
|
/**
|
|
7
8
|
* One root as a line: the declaration's reference, why it is a root, and the string
|
|
8
9
|
* that named it, separated by tabs. A run of several configurations adds the ones
|
package/dist/src/verbs/verb.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CONTRACT_VERSION } from "../
|
|
2
|
-
import {
|
|
1
|
+
import { CONTRACT_VERSION, EXIT_CLEAN } from "../contract/contract.generated.js";
|
|
2
|
+
import {} from "./verb.js";
|
|
3
3
|
/** Writes the version the host reports and the Contract version this analyzer implements. */
|
|
4
4
|
export const versionVerb = ({ out, host }) => {
|
|
5
5
|
out.write(`deadset-ts ${host.analyzerVersion()}\ncontract ${CONTRACT_VERSION}\n`);
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cplieger/deadset-ts",
|
|
3
|
-
"version": "8.0.0-dev.
|
|
3
|
+
"version": "8.0.0-dev.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Deterministic dead-code analysis for TypeScript, class and type members included",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "tsc -p tsconfig.build.json",
|
|
22
|
+
"gen": "node scripts/gen-contract.ts",
|
|
22
23
|
"prepack": "npm run build",
|
|
23
24
|
"typecheck": "tsc -p tsconfig.json",
|
|
24
25
|
"typecheck:tests": "tsc -p tsconfig.test.json",
|
package/src/analysis.ts
CHANGED
|
@@ -1437,7 +1437,7 @@ function nearestManifestDir(host: Host, root: string, file: string): string {
|
|
|
1437
1437
|
|
|
1438
1438
|
/**
|
|
1439
1439
|
* The input every emitter reads over one sweep of a read run: the facts beside the sweep
|
|
1440
|
-
* each
|
|
1440
|
+
* each emitter reads, every per-project one read in the same session as the sweep.
|
|
1441
1441
|
*/
|
|
1442
1442
|
export function emitterInputOver(
|
|
1443
1443
|
host: Host,
|
|
@@ -1523,7 +1523,7 @@ interface AnalysisReader {
|
|
|
1523
1523
|
* directives, the ignore file's entries and the baseline's rows are bound before any
|
|
1524
1524
|
* sweep, and the run is swept once under every bound record's mark and once under none,
|
|
1525
1525
|
* so a record is decided against the finding its code would have produced. The
|
|
1526
|
-
*
|
|
1526
|
+
* configuration family reports the refused suppressions and the roots that named nothing.
|
|
1527
1527
|
* Beside the inputs it answers the projects and test-file rules a report names.
|
|
1528
1528
|
*/
|
|
1529
1529
|
function readAnalysis(
|
|
@@ -1698,7 +1698,7 @@ export interface RunAnalysis {
|
|
|
1698
1698
|
|
|
1699
1699
|
/**
|
|
1700
1700
|
* The analysis of the run the scope and the configuration describe: the run read with its
|
|
1701
|
-
* suppressions bound, every
|
|
1701
|
+
* suppressions bound, every emitter's findings with the suppressions applied and the
|
|
1702
1702
|
* declared edges evaluated, the projects and test-file rules the report names, and the sweep
|
|
1703
1703
|
* an explanation reads.
|
|
1704
1704
|
*/
|
package/src/config.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CONTRACT_VERSION,
|
|
3
|
+
type Confidence,
|
|
4
|
+
type Format,
|
|
5
|
+
type Language,
|
|
6
|
+
type Severity,
|
|
7
|
+
} from "./contract/contract.generated.ts";
|
|
2
8
|
|
|
3
9
|
/**
|
|
4
10
|
* The name of the repository configuration at the target root, which is also the
|
|
@@ -21,21 +27,12 @@ export function kindOf(setting: TargetKindSetting, language: Language): TargetKi
|
|
|
21
27
|
return typeof setting === "string" ? setting : setting[language];
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
/** The lowest reachability class a finding must reach to be reported. */
|
|
25
|
-
export type Confidence = "certain" | "probable" | "possible";
|
|
26
|
-
|
|
27
30
|
/** Whether declarations in generated files are analyzed. */
|
|
28
31
|
export type GeneratedFiles = "exclude" | "include";
|
|
29
32
|
|
|
30
33
|
/** How a reference from a consumer's test file counts. */
|
|
31
34
|
export type ConsumerTests = "test" | "production";
|
|
32
35
|
|
|
33
|
-
/** One language an analysis covers. */
|
|
34
|
-
export type Language = "go" | "ts";
|
|
35
|
-
|
|
36
|
-
/** What a finding of one issue kind does to a run. */
|
|
37
|
-
export type Severity = "allow" | "warn" | "deny";
|
|
38
|
-
|
|
39
36
|
/** The severities ranked, the strongest highest. */
|
|
40
37
|
const SEVERITY_RANK: Readonly<Record<Severity, number>> = { allow: 0, warn: 1, deny: 2 };
|
|
41
38
|
|
|
@@ -44,9 +41,6 @@ export function fails(severity: Severity, failOn: Severity): boolean {
|
|
|
44
41
|
return SEVERITY_RANK[severity] >= SEVERITY_RANK[failOn];
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
/** One rendering of the finding list. */
|
|
48
|
-
export type Format = "text" | "json" | "github" | "sarif" | "template";
|
|
49
|
-
|
|
50
44
|
/** The order findings are rendered in. */
|
|
51
45
|
export type Sort = "position" | "size";
|
|
52
46
|
|
|
@@ -4,7 +4,7 @@ export const RECORD = {
|
|
|
4
4
|
conformance: {
|
|
5
5
|
corpusVersion: "6.0.0",
|
|
6
6
|
result: "pass",
|
|
7
|
-
digest: "sha256:
|
|
7
|
+
digest: "sha256:34a8ab2311bbd063b1f341d0e01e35c7fdd059ca3bcd288a60df4491dc177734",
|
|
8
8
|
},
|
|
9
9
|
gaps: [],
|
|
10
10
|
} as const;
|