@cplieger/deadset-ts 8.0.0-dev.4 → 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.
Files changed (90) hide show
  1. package/dist/src/analysis.js +3 -3
  2. package/dist/src/config.js +1 -1
  3. package/dist/src/conformance-record.js +1 -1
  4. package/dist/src/contract/contract.generated.js +1071 -0
  5. package/dist/src/contract/report.generated.js +796 -0
  6. package/dist/src/convention-rows.js +1 -1
  7. package/dist/src/exempt-classes.js +1 -59
  8. package/dist/src/exempt.js +8 -19
  9. package/dist/src/findings/completion.js +11 -20
  10. package/dist/src/findings/dependencies-and-module-machinery.js +4 -5
  11. package/dist/src/findings/emitters.js +4 -4
  12. package/dist/src/findings/interfaces.js +4 -5
  13. package/dist/src/findings/intra-function.js +8 -7
  14. package/dist/src/findings/non-code-artifacts.js +5 -6
  15. package/dist/src/findings/reads-and-writes.js +9 -8
  16. package/dist/src/findings/self-check.js +7 -10
  17. package/dist/src/findings/unused-declarations.js +28 -27
  18. package/dist/src/findings/visibility-narrowing.js +9 -11
  19. package/dist/src/findings-pass.js +1 -3
  20. package/dist/src/index.js +1 -1
  21. package/dist/src/intra-function-parts.js +8 -13
  22. package/dist/src/kinds.js +4 -360
  23. package/dist/src/report-schema.js +273 -0
  24. package/dist/src/report.js +17 -11
  25. package/dist/src/resolve.js +1 -6
  26. package/dist/src/run.js +2 -1
  27. package/dist/src/setup-failure.js +2 -6
  28. package/dist/src/suppress-file.js +4 -3
  29. package/dist/src/suppress-inline.js +3 -2
  30. package/dist/src/suppress.js +29 -48
  31. package/dist/src/verbs/analyze.js +7 -2
  32. package/dist/src/verbs/describe.js +4 -4
  33. package/dist/src/verbs/explain.js +2 -1
  34. package/dist/src/verbs/print-config.js +2 -1
  35. package/dist/src/verbs/print-projects.js +2 -1
  36. package/dist/src/verbs/print-retained.js +2 -1
  37. package/dist/src/verbs/print-roots.js +2 -1
  38. package/dist/src/verbs/verb.js +1 -5
  39. package/dist/src/verbs/version.js +2 -2
  40. package/jsr.json +1 -1
  41. package/package.json +3 -2
  42. package/src/analysis.ts +3 -3
  43. package/src/config.ts +7 -13
  44. package/src/conformance-record.ts +1 -1
  45. package/src/contract/contract.generated.ts +1123 -0
  46. package/src/contract/report.generated.ts +1157 -0
  47. package/src/convention-rows.ts +1 -1
  48. package/src/exempt-classes.ts +1 -70
  49. package/src/exempt.ts +12 -20
  50. package/src/finding.ts +9 -9
  51. package/src/findings/completion.ts +22 -23
  52. package/src/findings/dependencies-and-module-machinery.ts +4 -7
  53. package/src/findings/emitter.ts +6 -7
  54. package/src/findings/emitters.ts +6 -6
  55. package/src/findings/interfaces.ts +4 -6
  56. package/src/findings/intra-function.ts +8 -8
  57. package/src/findings/non-code-artifacts.ts +5 -7
  58. package/src/findings/reads-and-writes.ts +13 -11
  59. package/src/findings/self-check.ts +8 -15
  60. package/src/findings/unused-declarations.ts +28 -27
  61. package/src/findings/visibility-narrowing.ts +9 -12
  62. package/src/findings-pass.ts +1 -4
  63. package/src/index.ts +1 -1
  64. package/src/intra-function-parts.ts +8 -14
  65. package/src/kinds.ts +6 -406
  66. package/src/report-schema.ts +366 -0
  67. package/src/report.ts +42 -195
  68. package/src/reporters/annotations.ts +2 -2
  69. package/src/reporters/json.ts +1 -1
  70. package/src/reporters/reporter.ts +2 -2
  71. package/src/reporters/reporters.ts +1 -1
  72. package/src/reporters/sarif.ts +13 -8
  73. package/src/reporters/text.ts +3 -3
  74. package/src/resolve.ts +11 -11
  75. package/src/run.ts +2 -1
  76. package/src/setup-failure.ts +5 -7
  77. package/src/suppress-file.ts +3 -4
  78. package/src/suppress-inline.ts +2 -2
  79. package/src/suppress.ts +39 -55
  80. package/src/verbs/analyze.ts +16 -4
  81. package/src/verbs/describe.ts +10 -4
  82. package/src/verbs/explain.ts +2 -1
  83. package/src/verbs/print-config.ts +2 -1
  84. package/src/verbs/print-projects.ts +2 -1
  85. package/src/verbs/print-retained.ts +2 -1
  86. package/src/verbs/print-roots.ts +2 -1
  87. package/src/verbs/verb.ts +0 -6
  88. package/src/verbs/version.ts +2 -2
  89. package/dist/src/version.js +0 -7
  90. 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 { EXIT_CLEAN } from "./verb.js";
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 { EXIT_CLEAN } from "./verb.js";
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 { EXIT_CLEAN, EXIT_FINDINGS } from "./verb.js";
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
@@ -1,5 +1 @@
1
- /** The exit codes the Contract's exit-code table names. */
2
- export const EXIT_CLEAN = 0;
3
- export const EXIT_FINDINGS = 1;
4
- export const EXIT_USAGE = 2;
5
- export const EXIT_FAILURE = 3;
1
+ export {};
@@ -1,5 +1,5 @@
1
- import { CONTRACT_VERSION } from "../version.js";
2
- import { EXIT_CLEAN } from "./verb.js";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cplieger/deadset-ts",
3
- "version": "8.0.0-dev.4",
3
+ "version": "8.0.0-dev.6",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cplieger/deadset-ts",
3
- "version": "8.0.0-dev.4",
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",
@@ -45,7 +46,7 @@
45
46
  "fast-check": "4.10.2",
46
47
  "prettier": "3.9.10",
47
48
  "typescript": "npm:@typescript/typescript6@6.0.2",
48
- "typescript-eslint": "8.71.1",
49
+ "typescript-eslint": "8.71.2",
49
50
  "vitest": "5.0.4"
50
51
  },
51
52
  "publishConfig": {
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 kind family reads, every per-project one read in the same session as the sweep.
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
- * self-check family reports the refused suppressions and the roots that named nothing.
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 family's findings with the suppressions applied and the
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 { CONTRACT_VERSION } from "./version.ts";
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:e2a3ba92a5a6fe81174439a944333daf8d17e52fdacb8599fc50e3adb1569773",
7
+ digest: "sha256:34a8ab2311bbd063b1f341d0e01e35c7fdd059ca3bcd288a60df4491dc177734",
8
8
  },
9
9
  gaps: [],
10
10
  } as const;