@hailstails/hone 1.1.0 → 1.3.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/ADOPTING.md +4 -4
- package/CHANGELOG.md +22 -0
- package/MIGRATING.md +5 -5
- package/README.md +14 -8
- package/api/audit.d.ts +1 -1
- package/api/testing.js +4 -4
- package/chunks/{chunk-BLGGM7AV.js → chunk-H4V72FCW.js} +1 -1
- package/chunks/{chunk-PVCA3ISA.js → chunk-PL2PNPAR.js} +1 -1
- package/chunks/{chunk-CBWWAKQY.js → chunk-T32FOWZA.js} +1 -1
- package/chunks/{chunk-MZTLH4EU.js → chunk-Y2KPZDDV.js} +21 -1
- package/chunks/{chunk-63SJV5ZY.js → chunk-YSN46EB3.js} +41 -22
- package/core/check/tool-command.js +47 -30
- package/docs/adding-a-discipline-or-mechanism.md +1 -1
- package/docs/extending.md +5 -6
- package/docs/output-contract.md +8 -4
- package/mechanisms/audit/CD-3/compiler-overrides.js +193 -29
- package/mechanisms/audit/CD-3/piece.json +35 -7
- package/mechanisms/audit/runner/README.md +3 -2
- package/mechanisms/audit/runner/runner.js +42 -6
- package/mechanisms/audit/runner/walker-piece.d.ts +12 -0
- package/mechanisms/eslint/runner/README.md +1 -1
- package/mechanisms/eslint/runner/runner.js +60 -23
- package/package.json +1 -1
- package/rules/CD-10/CHECKS.md +2 -2
- package/rules/CD-14/CHECKS.md +2 -2
- package/rules/CD-15/CHECKS.md +2 -2
- package/rules/CD-17/CHECKS.md +2 -2
- package/rules/CD-19/CHECKS.md +2 -2
- package/rules/CD-2/CHECKS.md +2 -2
- package/rules/CD-23/CHECKS.md +2 -2
- package/rules/CD-25/CHECKS.md +2 -2
- package/rules/CD-26/CHECKS.md +2 -2
- package/rules/CD-27/CHECKS.md +2 -2
- package/rules/CD-3/CHECKS.md +35 -11
- package/rules/CD-3/discipline.json +278 -0
- package/rules/CD-40/CHECKS.md +2 -2
- package/rules/CD-41/CHECKS.md +2 -2
- package/rules/CD-42/CHECKS.md +2 -2
- package/rules/CD-43/CHECKS.md +2 -2
- package/rules/CD-44/CHECKS.md +2 -2
- package/rules/CD-47/CHECKS.md +2 -2
- package/rules/CD-5/CHECKS.md +2 -2
- package/rules/CD-6/CHECKS.md +2 -2
- package/rules/CD-7/CHECKS.md +2 -2
- package/rules/CD-7a/CHECKS.md +2 -2
- package/rules/CD-8/CHECKS.md +2 -2
|
@@ -25,15 +25,16 @@ import {
|
|
|
25
25
|
reportOutputInEffect,
|
|
26
26
|
reportOutputSchema,
|
|
27
27
|
runCheck,
|
|
28
|
+
runReachedCheck,
|
|
28
29
|
runnerFailed,
|
|
29
30
|
shownFailureOf
|
|
30
|
-
} from "../../chunks/chunk-
|
|
31
|
-
import "../../chunks/chunk-
|
|
31
|
+
} from "../../chunks/chunk-YSN46EB3.js";
|
|
32
|
+
import "../../chunks/chunk-H4V72FCW.js";
|
|
32
33
|
import "../../chunks/chunk-YLZ73C7O.js";
|
|
33
34
|
import {
|
|
34
35
|
parsedJson,
|
|
35
36
|
readVersionOneJson
|
|
36
|
-
} from "../../chunks/chunk-
|
|
37
|
+
} from "../../chunks/chunk-PL2PNPAR.js";
|
|
37
38
|
import "../../chunks/chunk-RWQ4UNKY.js";
|
|
38
39
|
import "../../chunks/chunk-NA5L6PUE.js";
|
|
39
40
|
import {
|
|
@@ -45,7 +46,7 @@ import {
|
|
|
45
46
|
createDefaultPathPort,
|
|
46
47
|
moduleExtensionOf,
|
|
47
48
|
repoPathSchema
|
|
48
|
-
} from "../../chunks/chunk-
|
|
49
|
+
} from "../../chunks/chunk-Y2KPZDDV.js";
|
|
49
50
|
import {
|
|
50
51
|
TOOL_IDENTITY,
|
|
51
52
|
TOOL_RULE_SET,
|
|
@@ -774,7 +775,6 @@ var createDefaultProcessPort = (_options) => createProcessPort({ processSurface:
|
|
|
774
775
|
|
|
775
776
|
// core/exception-records/inherited-debt.ts
|
|
776
777
|
var RECORD_DEBT_SUBCOMMAND = "record-debt";
|
|
777
|
-
var INHERITED_DEBT_REASON = `Inherited debt: this file existed at the base revision ${TOOL_IDENTITY.command} ${RECORD_DEBT_SUBCOMMAND} was given, and broke this clause when it wrote this record. Nobody has reviewed it or decided it should stay. The record is forfeited when the file next changes.`;
|
|
778
778
|
var pairKey = (request) => `${clauseAddressText({ address: request.clause })} ${request.file}`;
|
|
779
779
|
var inlinePairs = (request) => request.unrecorded.flatMap(
|
|
780
780
|
(exception) => exception.kind === "inline-disable" ? [{ clause: exception.clause, file: exception.file }] : []
|
|
@@ -823,8 +823,27 @@ var inheritedDebtOf = (request) => {
|
|
|
823
823
|
);
|
|
824
824
|
};
|
|
825
825
|
var inheritedDebtEntriesOf = (request) => request.outcomes.flatMap(
|
|
826
|
-
(outcome) => outcome.effect === "recorded" ? [{ kind: "file-carve-out", clause: clauseAddressText({ address: outcome.clause }), file: outcome.file
|
|
826
|
+
(outcome) => outcome.effect === "recorded" ? [{ kind: "file-carve-out", clause: clauseAddressText({ address: outcome.clause }), file: outcome.file }] : []
|
|
827
827
|
);
|
|
828
|
+
var reachedOutcomeOf = (request) => {
|
|
829
|
+
const { outcome } = request;
|
|
830
|
+
if (outcome.effect !== "recorded") {
|
|
831
|
+
return outcome;
|
|
832
|
+
}
|
|
833
|
+
const mechanism = request.mechanisms.get(clauseAddressText({ address: outcome.clause }));
|
|
834
|
+
const unprojected = request.unprojected.find(
|
|
835
|
+
(candidate) => candidate.mechanism === mechanism && outcome.file.startsWith(`${candidate.folder}/`)
|
|
836
|
+
);
|
|
837
|
+
return unprojected === void 0 ? outcome : {
|
|
838
|
+
clause: outcome.clause,
|
|
839
|
+
file: outcome.file,
|
|
840
|
+
effect: "nested-configuration",
|
|
841
|
+
under: unprojected.folder,
|
|
842
|
+
selectionFolder: unprojected.selectionFolder,
|
|
843
|
+
mechanism: unprojected.mechanism
|
|
844
|
+
};
|
|
845
|
+
};
|
|
846
|
+
var reachedDebtOf = (request) => request.outcomes.map((outcome) => reachedOutcomeOf({ ...request, outcome }));
|
|
828
847
|
|
|
829
848
|
// core/check/command-line.ts
|
|
830
849
|
var SPLIT_RECORDS_SUBCOMMAND = "split-records";
|
|
@@ -893,7 +912,7 @@ var COMMANDS = {
|
|
|
893
912
|
]
|
|
894
913
|
},
|
|
895
914
|
[RECORD_DEBT_SUBCOMMAND]: {
|
|
896
|
-
summary: "add a
|
|
915
|
+
summary: "add a file carve-out naming only its clause and file to the exception records for each clause and file the check finds broken, as inherited debt, printing each pair and what was done",
|
|
897
916
|
options: [REPO_OPTION, ADOPTION_BASE_REVISION_OPTION, LEAVE_OPTION],
|
|
898
917
|
exits: [
|
|
899
918
|
{ code: 0, meaning: "every record needed was written, or none was needed" },
|
|
@@ -1274,6 +1293,8 @@ var scriptOptionNote = (request) => {
|
|
|
1274
1293
|
return `: ${request.cause.command} is not the first command of its script, ${UNJUDGED_OPTION}; give ${request.cause.command} a script of its own, such as ${quoted({ text: request.cause.invocation })}`;
|
|
1275
1294
|
case "wrapped":
|
|
1276
1295
|
return `: ${quoted({ text: request.cause.wrapper })} comes before ${request.cause.command} and is neither a package runner nor a NAME=value setting, ${UNJUDGED_OPTION}; put only package runners and NAME=value settings before ${request.cause.command}`;
|
|
1296
|
+
case "unreadable":
|
|
1297
|
+
return `: a quote in the script has no partner, so Hone cannot read what the script passes to ${request.cause.command} or tell what that does to the files under check; pair every quote in the script`;
|
|
1277
1298
|
}
|
|
1278
1299
|
};
|
|
1279
1300
|
var inlineDetail = (request) => `${request.exception.file}:${request.exception.line} ${escapedLineBreaks({ text: request.exception.text })}`;
|
|
@@ -1513,6 +1534,8 @@ var inheritedDebtNote = (request) => {
|
|
|
1513
1534
|
return ": the base revision does not hold this file, so its debt was not inherited; fix it, or record it with its own reason";
|
|
1514
1535
|
case "refused":
|
|
1515
1536
|
return ": the clause's discipline refuses exceptions; fix it";
|
|
1537
|
+
case "nested-configuration":
|
|
1538
|
+
return `: the file loads the ${outcome.mechanism} configuration in ${outcome.under}, and ${outcome.selectionFolder} holds its own disciplines.json; nested Hone configurations are not supported yet (${NESTED_CONFIGURATION_ISSUE}), so the ${outcome.mechanism} projection cannot put a record on this file into effect; fix it, or govern ${outcome.selectionFolder} from this repository by removing ${outcome.selectionFolder}/disciplines.json, then run ${RECORD_DEBT_SUBCOMMAND} again`;
|
|
1516
1539
|
}
|
|
1517
1540
|
};
|
|
1518
1541
|
var inheritedDebtLine = (request) => `${clauseAddressText({ address: request.outcome.clause })} ${request.outcome.effect} ${request.outcome.file}${inheritedDebtNote(request)}
|
|
@@ -1729,45 +1752,39 @@ var runProjectCommand = (request) => projectResult(request).then(
|
|
|
1729
1752
|
);
|
|
1730
1753
|
|
|
1731
1754
|
// core/check/run-record-debt-command.ts
|
|
1732
|
-
var SELECTION_FILE_NAME2 = "disciplines.json";
|
|
1733
1755
|
var ASSESSED_IN_THIS_RUN = { forfeiture: "this-run" };
|
|
1734
|
-
var reasonOnlySelection = (request) => {
|
|
1735
|
-
const reading = readSelection({ ...request, moduleExtension: moduleExtensionOf({ moduleUrl: request.moduleUrl }) });
|
|
1736
|
-
if (reading.outcome === "failed" || reading.value.fileExceptionWhyChains === "optional") {
|
|
1737
|
-
return reading;
|
|
1738
|
-
}
|
|
1739
|
-
return {
|
|
1740
|
-
outcome: "failed",
|
|
1741
|
-
error: { kind: "why-chains-required", path: request.path.join({ segments: [request.repoRoot, SELECTION_FILE_NAME2] }) }
|
|
1742
|
-
};
|
|
1743
|
-
};
|
|
1744
1756
|
var pathsInBase = (request) => {
|
|
1745
1757
|
const listed2 = request.gitTree.pathsAt({ repoRoot: request.repoRoot, revision: request.arguments.baseRevision });
|
|
1746
1758
|
return listed2.outcome === "failed" ? { outcome: "failed", error: { kind: "git-failed", detail: `${listed2.error.command}: ${listed2.error.detail}` } } : { outcome: "ok", value: new Set(listed2.value) };
|
|
1747
1759
|
};
|
|
1760
|
+
var clauseMechanismsOf = (request) => new Map(request.selection.selection.selected.map((clause) => [clauseAddressText({ address: clause.address }), clause.mechanism]));
|
|
1748
1761
|
var debtOutcomesOf = async (request) => {
|
|
1749
|
-
const
|
|
1762
|
+
const reached = await runReachedCheck({
|
|
1750
1763
|
...request,
|
|
1751
1764
|
moduleExtension: moduleExtensionOf({ moduleUrl: request.moduleUrl }),
|
|
1752
1765
|
baseRevision: request.arguments.baseRevision,
|
|
1753
1766
|
assessment: ASSESSED_IN_THIS_RUN
|
|
1754
1767
|
});
|
|
1755
|
-
if (
|
|
1756
|
-
return
|
|
1757
|
-
}
|
|
1758
|
-
const outcomes =
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1768
|
+
if (reached.outcome === "failed") {
|
|
1769
|
+
return reached;
|
|
1770
|
+
}
|
|
1771
|
+
const outcomes = reachedDebtOf({
|
|
1772
|
+
outcomes: inheritedDebtOf({
|
|
1773
|
+
findings: reached.value.report.findings,
|
|
1774
|
+
unrecorded: reached.value.report.unrecorded,
|
|
1775
|
+
existing: request.existing,
|
|
1776
|
+
leave: request.arguments.leave,
|
|
1777
|
+
inBase: request.inBase,
|
|
1778
|
+
refusing: request.selection.selection.selected.flatMap((clause) => clause.exceptions === "refused" ? [clause.address] : [])
|
|
1779
|
+
}),
|
|
1780
|
+
unprojected: reached.value.unprojected,
|
|
1781
|
+
mechanisms: clauseMechanismsOf(request)
|
|
1765
1782
|
});
|
|
1766
1783
|
const written = request.exceptionRepository.add({ entries: inheritedDebtEntriesOf({ outcomes }) });
|
|
1767
1784
|
return written.outcome === "failed" ? written : { outcome: "ok", value: outcomes };
|
|
1768
1785
|
};
|
|
1769
1786
|
var adoptionDebt = (request) => {
|
|
1770
|
-
const selection =
|
|
1787
|
+
const selection = readSelection({ ...request, moduleExtension: moduleExtensionOf({ moduleUrl: request.moduleUrl }) });
|
|
1771
1788
|
if (selection.outcome === "failed") {
|
|
1772
1789
|
return Promise.resolve(selection);
|
|
1773
1790
|
}
|
|
@@ -167,7 +167,7 @@ These hold for every discipline and mechanism. Tests under `core/check/` check t
|
|
|
167
167
|
An embedded runner has the same `run` and `conform` as a standalone one, plus:
|
|
168
168
|
|
|
169
169
|
- `projectedKinds`: the native exception kinds its own projection writes. Only these kinds can be matched by a record.
|
|
170
|
-
- `run` also receives the repository's exception records for that mechanism, so it can regenerate the projection and compare it. It returns hits, the native exceptions it found, and the projection's state: `current`, `out-of-date`, `missing` or `not-included`. A projection that is missing or not included means the mechanism did not run: core lists `mechanism-not-run` and the check fails. An out-of-date one is a projection problem and also fails. It may also return `slices`, each a projection file other than the root one with its state, `missing`, `out-of-date`, `not-applied`, `unconfigured` or `nested-configuration`; a runner reports `nested-configuration` only beside a `not-included` projection, for a folder holding its own `disciplines.json` whose own config left the projection out of effect, and core names that folder on the `mechanism-not-run` entry; core lists each other state as a projection problem naming the file. A runner that returns none has none.
|
|
170
|
+
- `run` also receives the repository's exception records for that mechanism, so it can regenerate the projection and compare it. It returns hits, the native exceptions it found, and the projection's state: `current`, `out-of-date`, `missing` or `not-included`. A projection that is missing or not included means the mechanism did not run: core lists `mechanism-not-run` and the check fails. An out-of-date one is a projection problem and also fails. It may also return `slices`, each a projection file other than the root one with its state, `missing`, `out-of-date`, `not-applied`, `unconfigured` or `nested-configuration`; a runner reports `nested-configuration` only beside a `not-included` projection, for a folder holding its own `disciplines.json` whose own config left the projection out of effect, and core names that folder on the `mechanism-not-run` entry; core lists each other state as a projection problem naming the file. A runner that returns none has none. It may also return `unprojectedFolders`: each `folder` whose files load a configuration the projection never reaches, such as one inside a folder holding its own `disciplines.json`, with the outermost such `selectionFolder` that holds it. The check prints nothing for them; `hone record-debt` writes no record for a file under one and prints a `nested-configuration` line instead, since that record could not take effect. A runner that returns none has none, and its type, `ReturnedEmbeddedRunReport`, leaves the field optional.
|
|
171
171
|
- `project`: writes the projection files and returns each path with `written`, `unchanged`, `removed` or `left-in-place`. `hone project` calls it.
|
|
172
172
|
|
|
173
173
|
Core passes every record for the mechanism to both calls, forfeited or not, and never passes the touched set. A forfeited file carve-out therefore stays in the projection; core's check reports it as `forfeited`, no longer counts it as holding any native exception, so each one it held is listed under `unrecorded`, and fails the run. Keep it that way: a runner must not compute forfeiture or read the touched set itself, so that whether a forfeited carve-out stays pushed down remains core's decision. No test checks this; it is a rule for review.
|
package/docs/extending.md
CHANGED
|
@@ -223,7 +223,7 @@ export const check: WalkerPiece = {
|
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
- `module` is a path inside the piece folder, and the module exports `check`.
|
|
226
|
-
- `prepare` runs once with the selected clauses, the repository's file list and TypeScript's syntax API. `prepareFile` runs once per tracked file and returns `skipped`, `complete` with its hits, or `syntax` with observers that walk the file's syntax tree. `finish` returns hits that need the whole repository.
|
|
226
|
+
- `prepare` runs once with the selected clauses, the repository's file list and TypeScript's syntax API. The repository also carries a `disk`, a required field: its `root`, the kind of entry at an absolute path (`kindAt`) and a file's text (`textAt`), for a piece that must read files beyond the one it is given, untracked ones included. In a conformance case the disk holds only the case's file. A piece's own tests that build a `WalkerRepository` by hand must now give it a `disk` (the type is `WalkerDisk` from `@hailstails/hone/audit`), as the example's proof does. Such tests written before the field was added no longer type-check until they give it one. `prepareFile` runs once per tracked file and returns `skipped`, `complete` with its hits, or `syntax` with observers that walk the file's syntax tree. `finish` returns hits that need the whole repository.
|
|
227
227
|
- A hit passes back the clause's `address` unchanged, a 1-based line and 0-based column, and a short snippet.
|
|
228
228
|
- When the piece cannot run, for example on settings it does not accept, return a failed result whose error is a `PieceFailure`: `kind` `piece-invalid`, the clause's `pieceRoot` and a `detail`. `hone check` then stops with a load failure naming the piece folder.
|
|
229
229
|
- When the piece cannot parse a file, return a failed result whose error is `kind` `file-unparseable`, the `file` and a `detail`. `hone check` then stops with `load failure: runner-failed audit file-unparseable <file> <detail>`.
|
|
@@ -344,18 +344,17 @@ Checks of your own call the piece directly. `clauseUnderTestOf` returns the same
|
|
|
344
344
|
|
|
345
345
|
## Exceptions
|
|
346
346
|
|
|
347
|
-
Exception records in `discipline-exceptions.json` name team clauses by their full address and work exactly as for Hone's own clauses. This entry
|
|
347
|
+
Exception records in `discipline-exceptions.json` name team clauses by their full address and work exactly as for Hone's own clauses. This entry records the console calls already in `src/start-banner.ts` as debt: it moves the finding to `exempted` and, after `hone project`, turns the rule off for that file in the team's own ESLint run, until the file is next touched and the record is forfeited:
|
|
348
348
|
|
|
349
349
|
```json
|
|
350
350
|
{
|
|
351
|
-
"kind": "
|
|
351
|
+
"kind": "file-carve-out",
|
|
352
352
|
"clause": "acme/ACME-1#console-calls",
|
|
353
|
-
"file": "src/start-banner.ts"
|
|
354
|
-
"reason": "The start banner is the one place that writes to the terminal."
|
|
353
|
+
"file": "src/start-banner.ts"
|
|
355
354
|
}
|
|
356
355
|
```
|
|
357
356
|
|
|
358
|
-
|
|
357
|
+
A `file-carve-out` is debt and needs no `whyChain` and no `reason`. Where the clause does not apply to a file at all, record an `authorised-location` instead: it is never forfeited, so it needs a `reason` and a `whyChain` that follows the [why-chain contract](why-chain-contract.md), and without the chain it is refused as `evidence-refused`. [README.md](../README.md#discipline-exceptionsjson) describes the record kinds and what each needs.
|
|
359
358
|
|
|
360
359
|
## What is stable
|
|
361
360
|
|
package/docs/output-contract.md
CHANGED
|
@@ -61,7 +61,7 @@ In the tables below, a word in angle brackets, such as `<clause>`, stands for a
|
|
|
61
61
|
| `<dir>` | the `--repo` value as typed | may hold a space |
|
|
62
62
|
| `<url>` | the module URL Hone could not resolve, as given | may hold a space |
|
|
63
63
|
| `<snippet>` | the source text at a finding: at most 200 characters, or the first 200 followed by `…` when it is longer | may hold a space |
|
|
64
|
-
| `<comment>`, `<script>`, `<option>`, `<source>` | the native exception's comment, the `package.json` script name and the option in it, or where an imported record came from | may hold a space |
|
|
64
|
+
| `<comment>`, `<script>`, `<option>`, `<source>` | the native exception's comment, the `package.json` script name and the option in it (or the whole script, when a quote in it has no partner), or where an imported record came from | may hold a space |
|
|
65
65
|
| `<detail>`, `<given>`, `<values>`, `<rule set>`, `<other rule set>`, `<clause with its rule set>`, `<version found>`, `<other package>`, `<range>` | text from the input, a tool or the command as typed | may hold a space |
|
|
66
66
|
|
|
67
67
|
Paths are printed with forward slashes. A path inside the `--repo` folder is printed relative to it, in the report and in load failures alike. A path outside it is printed absolute, such as `C:/Users/me/shared/rule.json` on Windows. A load failure from before `--repo` is resolved names the folder as typed (`<dir>`). A path into Hone's own package, such as a `<rule page>`, the `<adoption guide>`, a `<piece folder>` or the `<install folder>`, is printed through the repository's `node_modules/@hailstails/hone` when that folder holds the same `package.json` as the package that is running, as it does under pnpm, which runs the package from its store under `node_modules/.pnpm`. When the repository root has no such folder, as when the package is installed only in a workspace package, installed globally or run from a source checkout, the path is printed where the running package is, by the rules above. A load failure reading the installed package's own `package.json`, which only `hone --version` reads, prints its absolute path. A path inside a `<detail>` is printed however the tool that wrote the detail printed it.
|
|
@@ -89,7 +89,7 @@ Checks a repository against the disciplines it selects, applies its recorded exc
|
|
|
89
89
|
commands:
|
|
90
90
|
check check the repository against the disciplines it selects and print the report, ending in its verdict
|
|
91
91
|
project write the native configuration each selected embedded mechanism needs, printing each file as written or unchanged
|
|
92
|
-
record-debt add a
|
|
92
|
+
record-debt add a file carve-out naming only its clause and file to the exception records for each clause and file the check finds broken, as inherited debt, printing each pair and what was done
|
|
93
93
|
split-records move the exception records from discipline-exceptions.json into the discipline-exceptions folder, one file for each record kind and discipline, printing each file as written or removed
|
|
94
94
|
|
|
95
95
|
options:
|
|
@@ -147,7 +147,7 @@ exit codes:
|
|
|
147
147
|
```text
|
|
148
148
|
usage: hone record-debt --repo <dir> --base-revision <revision> [--leave <path>]...
|
|
149
149
|
|
|
150
|
-
add a
|
|
150
|
+
add a file carve-out naming only its clause and file to the exception records for each clause and file the check finds broken, as inherited debt, printing each pair and what was done
|
|
151
151
|
|
|
152
152
|
options:
|
|
153
153
|
--repo <dir>
|
|
@@ -261,6 +261,7 @@ Each section's entries take one of these shapes. An exempted finding repeats ` e
|
|
|
261
261
|
| `unrecorded` | `<clause> <mechanism> command-line-option <package file> <script> <option> weakens the script's whole run, so no record can cover it: remove it from the script` |
|
|
262
262
|
| `unrecorded` | `<clause> <mechanism> command-line-option <package file> <script> <option>: <command> is not the first command of its script, so Hone cannot tell what the option does to the files under check; give <command> a script of its own, such as <invocation>` |
|
|
263
263
|
| `unrecorded` | `<clause> <mechanism> command-line-option <package file> <script> <option>: <wrapper> comes before <command> and is neither a package runner nor a NAME=value setting, so Hone cannot tell what the option does to the files under check; put only package runners and NAME=value settings before <command>` |
|
|
264
|
+
| `unrecorded` | `<clause> <mechanism> command-line-option <package file> <script> <option>: a quote in the script has no partner, so Hone cannot read what the script passes to <command> or tell what that does to the files under check; pair every quote in the script` |
|
|
264
265
|
| `doublyHeld` | `<clause> <mechanism> doubly-held <file>` |
|
|
265
266
|
| `invalidRecords` | `exceptions[<index>] clause-unparseable <detail>` |
|
|
266
267
|
| `invalidRecords` | `exceptions[<index>] clause-not-selected <clause>` |
|
|
@@ -317,6 +318,8 @@ Each section's entries take one of these shapes. An exempted finding repeats ` e
|
|
|
317
318
|
|
|
318
319
|
A run that cannot decide prints one line and exits `2`. It prints the same line in every output. The line starts with `load failure: ` and its kind; the values follow in the order shown, and any text after the values is not stable.
|
|
319
320
|
|
|
321
|
+
`hone record-debt` no longer prints `why-chains-required`: a file carve-out is debt and needs no `whyChain`, so it writes its records whatever `fileExceptionWhyChains` says. The kind keeps its line below until a major release removes it, so a tool that matches it keeps working.
|
|
322
|
+
|
|
320
323
|
| Kind | Line |
|
|
321
324
|
| --- | --- |
|
|
322
325
|
| `arguments-invalid` | `load failure: arguments-invalid <detail>` |
|
|
@@ -390,7 +393,7 @@ An `arguments-invalid` line says what was wrong with the command as typed. Its w
|
|
|
390
393
|
|
|
391
394
|
## hone record-debt
|
|
392
395
|
|
|
393
|
-
`hone record-debt` runs the check, then prints one line for each clause and file that has a finding, or an inline disable or TypeScript directive under `unrecorded`, ordered by file and then by clause. A `recorded` line is a `file-carve-out` it added to the exception records, in whichever [layout](../README.md#the-split-layout) the repository keeps them; every other line names a pair it wrote nothing for. It prints nothing when the check finds nothing to record. The `<path>` on a `left` line is the `--leave` value that covers the file.
|
|
396
|
+
`hone record-debt` runs the check, then prints one line for each clause and file that has a finding, or an inline disable or TypeScript directive under `unrecorded`, ordered by file and then by clause. A `recorded` line is a `file-carve-out` it added to the exception records, in whichever [layout](../README.md#the-split-layout) the repository keeps them; every other line names a pair it wrote nothing for. It prints nothing when the check finds nothing to record. The `<path>` on a `left` line is the `--leave` value that covers the file. A `nested-configuration` line names a pair whose clause runs on an embedded mechanism, such as ESLint, in a file that loads the configuration in `<config folder>`, at or under the outermost `<folder>` that holds its own `disciplines.json`. The projection never reaches that configuration, so a record there would leave the projection out of effect and fail the next check.
|
|
394
397
|
|
|
395
398
|
| Output | Line |
|
|
396
399
|
| --- | --- |
|
|
@@ -399,6 +402,7 @@ An `arguments-invalid` line says what was wrong with the command as typed. Its w
|
|
|
399
402
|
| `record-debt` | `<clause> left <file>: under --leave <path>; record it as an authorised-location with its own reason, or fix it` |
|
|
400
403
|
| `record-debt` | `<clause> new-file <file>: the base revision does not hold this file, so its debt was not inherited; fix it, or record it with its own reason` |
|
|
401
404
|
| `record-debt` | `<clause> refused <file>: the clause's discipline refuses exceptions; fix it` |
|
|
405
|
+
| `record-debt` | `<clause> nested-configuration <file>: the file loads the <mechanism> configuration in <config folder>, and <folder> holds its own disciplines.json; nested Hone configurations are not supported yet (https://github.com/HailsTails/hone/issues/72), so the <mechanism> projection cannot put a record on this file into effect; fix it, or govern <folder> from this repository by removing <folder>/disciplines.json, then run record-debt again` |
|
|
402
406
|
|
|
403
407
|
## hone split-records
|
|
404
408
|
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
editionSchema
|
|
3
|
+
} from "../../../chunks/chunk-RWQ4UNKY.js";
|
|
4
|
+
import {
|
|
5
|
+
editionReaches
|
|
6
|
+
} from "../../../chunks/chunk-NA5L6PUE.js";
|
|
7
|
+
import "../../../chunks/chunk-MXSIQPCV.js";
|
|
1
8
|
import {
|
|
2
9
|
folderScope
|
|
3
10
|
} from "../../../chunks/chunk-QWA6OVLC.js";
|
|
@@ -35,12 +42,107 @@ var createDefaultJsoncParsePort = (options) => createJsoncParsePort({
|
|
|
35
42
|
parseProvider: defaultProviderCallOf(options)
|
|
36
43
|
});
|
|
37
44
|
|
|
38
|
-
// mechanisms/audit/CD-3/compiler-
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
// mechanisms/audit/CD-3/typescript-compiler-options.ts
|
|
46
|
+
var FILE_LIST_DIAGNOSTICS = [18002, 18003];
|
|
47
|
+
var STRICT_FAMILY = ["strict", "useUnknownInCatchVariables"];
|
|
48
|
+
var WILDCARD = /[*?]/;
|
|
49
|
+
var recordingHostOf = (request) => {
|
|
50
|
+
const listed = [];
|
|
51
|
+
return {
|
|
52
|
+
host: {
|
|
53
|
+
useCaseSensitiveFileNames: request.syntaxApi.sys.useCaseSensitiveFileNames,
|
|
54
|
+
fileExists: (path) => request.disk.kindAt({ path }) === "file",
|
|
55
|
+
directoryExists: (path) => request.disk.kindAt({ path }) === "directory",
|
|
56
|
+
readFile: (path) => {
|
|
57
|
+
const text = request.disk.textAt({ path });
|
|
58
|
+
return text.outcome === "ok" ? text.value : void 0;
|
|
59
|
+
},
|
|
60
|
+
readDirectory: (...listing) => {
|
|
61
|
+
const [, , , includes] = listing;
|
|
62
|
+
listed.push(...includes);
|
|
63
|
+
return [];
|
|
64
|
+
},
|
|
65
|
+
getCurrentDirectory: () => request.root
|
|
66
|
+
},
|
|
67
|
+
includesListed: () => listed
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
var shownPath = (request) => request.path.startsWith(`${request.root}/`) ? request.path.slice(request.root.length + 1) : request.path;
|
|
71
|
+
var shownText = (request) => request.text.split(`${request.root}/`).join("");
|
|
72
|
+
var folderOf = (request) => request.path.slice(0, request.path.lastIndexOf("/"));
|
|
73
|
+
var stateOf = (request) => request.turnedOn === true ? "on" : "off";
|
|
74
|
+
var settingOf = (request) => {
|
|
75
|
+
const setting = Object.entries(request.compilerOptions).find(([key]) => key === request.option)?.[1];
|
|
76
|
+
return typeof setting === "boolean" ? stateOf({ turnedOn: setting }) : "unset";
|
|
77
|
+
};
|
|
78
|
+
var settingsOf = (request) => {
|
|
79
|
+
const config = request.config;
|
|
80
|
+
const compilerOptions = typeof config === "object" && config !== null && "compilerOptions" in config ? config.compilerOptions : void 0;
|
|
81
|
+
const options = typeof compilerOptions === "object" && compilerOptions !== null ? compilerOptions : {};
|
|
82
|
+
return {
|
|
83
|
+
strict: settingOf({ compilerOptions: options, option: "strict" }),
|
|
84
|
+
noUncheckedIndexedAccess: settingOf({ compilerOptions: options, option: "noUncheckedIndexedAccess" }),
|
|
85
|
+
exactOptionalPropertyTypes: settingOf({ compilerOptions: options, option: "exactOptionalPropertyTypes" }),
|
|
86
|
+
noImplicitOverride: settingOf({ compilerOptions: options, option: "noImplicitOverride" }),
|
|
87
|
+
noFallthroughCasesInSwitch: settingOf({ compilerOptions: options, option: "noFallthroughCasesInSwitch" }),
|
|
88
|
+
noPropertyAccessFromIndexSignature: settingOf({ compilerOptions: options, option: "noPropertyAccessFromIndexSignature" }),
|
|
89
|
+
useUnknownInCatchVariables: settingOf({ compilerOptions: options, option: "useUnknownInCatchVariables" })
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
var strictFamilyStateOf = (request) => {
|
|
93
|
+
const api = request.syntaxApi;
|
|
94
|
+
if ("getStrictOptionValue" in api && typeof api.getStrictOptionValue === "function") {
|
|
95
|
+
return stateOf({ turnedOn: api.getStrictOptionValue(request.options, request.option) });
|
|
96
|
+
}
|
|
97
|
+
return stateOf({ turnedOn: request.options[request.option] ?? request.options.strict });
|
|
98
|
+
};
|
|
99
|
+
var effectiveValueOf = (request) => STRICT_FAMILY.includes(request.option) ? strictFamilyStateOf(request) : stateOf({ turnedOn: request.options[request.option] });
|
|
100
|
+
var effectiveOf = (request) => ({
|
|
101
|
+
strict: effectiveValueOf({ ...request, option: "strict" }),
|
|
102
|
+
noUncheckedIndexedAccess: effectiveValueOf({ ...request, option: "noUncheckedIndexedAccess" }),
|
|
103
|
+
exactOptionalPropertyTypes: effectiveValueOf({ ...request, option: "exactOptionalPropertyTypes" }),
|
|
104
|
+
noImplicitOverride: effectiveValueOf({ ...request, option: "noImplicitOverride" }),
|
|
105
|
+
noFallthroughCasesInSwitch: effectiveValueOf({ ...request, option: "noFallthroughCasesInSwitch" }),
|
|
106
|
+
noPropertyAccessFromIndexSignature: effectiveValueOf({ ...request, option: "noPropertyAccessFromIndexSignature" }),
|
|
107
|
+
useUnknownInCatchVariables: effectiveValueOf({ ...request, option: "useUnknownInCatchVariables" })
|
|
108
|
+
});
|
|
109
|
+
var baseOf = (request) => ({
|
|
110
|
+
file: shownPath(request),
|
|
111
|
+
settings: settingsOf({ config: request.syntaxApi.readConfigFile(request.path, request.host.readFile).config })
|
|
112
|
+
});
|
|
113
|
+
var unresolvedDetail = (request) => request.diagnostics.map((diagnostic) => `TS${diagnostic.code} ${shownText({ ...request, text: request.syntaxApi.flattenDiagnosticMessageText(diagnostic.messageText, " ") })}`).join("; ");
|
|
114
|
+
var compiledFilesOf = (request) => {
|
|
115
|
+
if (request.parsed.fileNames.length > 0) return "some";
|
|
116
|
+
if (Object.keys(request.parsed.wildcardDirectories ?? {}).length > 0) return "some";
|
|
117
|
+
return request.includesListed.some((include) => !WILDCARD.test(include)) ? "some" : "none";
|
|
118
|
+
};
|
|
119
|
+
var resolvedConfigOf = (request) => {
|
|
120
|
+
const host = request.recording.host;
|
|
121
|
+
const source = request.syntaxApi.readJsonConfigFile(request.path, host.readFile);
|
|
122
|
+
const parsed = request.syntaxApi.parseJsonSourceFileConfigFileContent(source, host, folderOf(request), void 0, request.path);
|
|
123
|
+
const diagnostics = parsed.errors.filter((diagnostic) => !FILE_LIST_DIAGNOSTICS.includes(diagnostic.code));
|
|
124
|
+
if (diagnostics.length > 0) return { kind: "unresolved", detail: unresolvedDetail({ ...request, diagnostics }) };
|
|
125
|
+
if (compiledFilesOf({ parsed, includesListed: request.recording.includesListed() }) === "none") return { kind: "compiles-nothing" };
|
|
126
|
+
return {
|
|
127
|
+
kind: "resolved",
|
|
128
|
+
effective: effectiveOf({ syntaxApi: request.syntaxApi, options: parsed.options }),
|
|
129
|
+
bases: (source.extendedSourceFiles ?? []).map((path) => baseOf({ ...request, host, path }))
|
|
130
|
+
};
|
|
43
131
|
};
|
|
132
|
+
var typeScriptCompilerOptionsOf = ({ syntaxApi, disk }) => {
|
|
133
|
+
const root = disk.root.split("\\").join("/");
|
|
134
|
+
return {
|
|
135
|
+
resolve: ({ file }) => {
|
|
136
|
+
const recording = recordingHostOf({ syntaxApi, disk, root });
|
|
137
|
+
return resolvedConfigOf({ syntaxApi, recording, root, path: `${root}/${file}` });
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// mechanisms/audit/CD-3/compiler-overrides.ts
|
|
143
|
+
var RESOLVING_EDITION = editionSchema.parse("2");
|
|
144
|
+
var IMPLIED_BY_STRICT = ["useUnknownInCatchVariables"];
|
|
145
|
+
var FILE_ANCHOR = { line: 1, column: 0 };
|
|
44
146
|
var STRICT_FLAGS = [
|
|
45
147
|
{ clause: "strict", option: "strict" },
|
|
46
148
|
{ clause: "no-unchecked-indexed-access", option: "noUncheckedIndexedAccess" },
|
|
@@ -50,9 +152,85 @@ var STRICT_FLAGS = [
|
|
|
50
152
|
{ clause: "no-property-access-from-index-signature", option: "noPropertyAccessFromIndexSignature" },
|
|
51
153
|
{ clause: "use-unknown-in-catch-variables", option: "useUnknownInCatchVariables" }
|
|
52
154
|
];
|
|
155
|
+
var configEligibility = (request) => {
|
|
156
|
+
if (request.file.split("/").at(-1) !== "tsconfig.json") return "excluded";
|
|
157
|
+
if (folderScope({ file: request.file }) === "generated") return "excluded";
|
|
158
|
+
return "eligible";
|
|
159
|
+
};
|
|
160
|
+
var selectedFlagsOf = (request) => STRICT_FLAGS.flatMap(
|
|
161
|
+
(flag) => request.clauses.filter((clause) => clause.address.discipline === "CD-3" && clause.address.clause === flag.clause).map((clause) => ({
|
|
162
|
+
address: clause.address,
|
|
163
|
+
option: flag.option,
|
|
164
|
+
judges: editionReaches({ edition: clause.edition, introducedIn: RESOLVING_EDITION }) === "reached" ? "resolved-options" : "own-options"
|
|
165
|
+
}))
|
|
166
|
+
);
|
|
167
|
+
var unparseable = (request) => ({
|
|
168
|
+
outcome: "failed",
|
|
169
|
+
error: { kind: "file-unparseable", file: request.file, detail: request.detail }
|
|
170
|
+
});
|
|
171
|
+
var ownOptionsOf = (request) => {
|
|
172
|
+
const config = request.config;
|
|
173
|
+
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
174
|
+
return unparseable({ file: request.file, detail: "configuration root must be an object" });
|
|
175
|
+
}
|
|
176
|
+
if (!("compilerOptions" in config)) return { outcome: "ok", value: [] };
|
|
177
|
+
const compilerOptions = config.compilerOptions;
|
|
178
|
+
if (typeof compilerOptions !== "object" || compilerOptions === null || Array.isArray(compilerOptions)) {
|
|
179
|
+
return unparseable({ file: request.file, detail: "compilerOptions must be an object" });
|
|
180
|
+
}
|
|
181
|
+
return { outcome: "ok", value: Object.entries(compilerOptions) };
|
|
182
|
+
};
|
|
183
|
+
var ownEntryOf = (request) => request.options.find(([key]) => key === request.option);
|
|
184
|
+
var ownSettingsOf = (request) => {
|
|
185
|
+
const strict = ownEntryOf({ options: request.options, option: "strict" })?.[1];
|
|
186
|
+
if (strict === true) return { strict: "on" };
|
|
187
|
+
return { strict: strict === false ? "off" : "unset" };
|
|
188
|
+
};
|
|
189
|
+
var turnsOff = (request) => {
|
|
190
|
+
const own = request.settings[request.option] ?? "unset";
|
|
191
|
+
if (own === "off") return "turns-off";
|
|
192
|
+
return own === "unset" && IMPLIED_BY_STRICT.includes(request.option) && request.settings.strict === "off" ? "turns-off" : "leaves";
|
|
193
|
+
};
|
|
194
|
+
var resolvedSnippet = (request) => {
|
|
195
|
+
const { option, resolved } = request;
|
|
196
|
+
if (resolved.effective[option] === "on") return void 0;
|
|
197
|
+
const thisFileTurnsOff = turnsOff({ settings: ownSettingsOf({ options: request.config.options }), option });
|
|
198
|
+
const offBases = resolved.bases.filter((base) => turnsOff({ settings: base.settings, option }) === "turns-off").map((base) => base.file);
|
|
199
|
+
if (thisFileTurnsOff === "turns-off") return `compilerOptions.${option} = false, turned off in ${[request.config.file, ...offBases].join(", ")}`;
|
|
200
|
+
if (offBases.length > 0) return `compilerOptions.${option} = false, inherited from ${offBases.join(", ")}`;
|
|
201
|
+
if (resolved.bases.length === 0) return `compilerOptions.${option} unset, and this file extends no base`;
|
|
202
|
+
return `compilerOptions.${option} unset here and in ${resolved.bases.map((base) => base.file).join(", ")}`;
|
|
203
|
+
};
|
|
204
|
+
var judgedSnippet = (request) => {
|
|
205
|
+
switch (request.resolved.kind) {
|
|
206
|
+
case "unresolved":
|
|
207
|
+
return `compilerOptions.${request.option} unknown: ${request.resolved.detail}`;
|
|
208
|
+
case "compiles-nothing":
|
|
209
|
+
return void 0;
|
|
210
|
+
case "resolved":
|
|
211
|
+
return resolvedSnippet({ config: request.config, resolved: request.resolved, option: request.option });
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var presenceHit = (request) => ({
|
|
215
|
+
clause: request.flag.address,
|
|
216
|
+
anchor: FILE_ANCHOR,
|
|
217
|
+
snippet: `compilerOptions.${request.flag.option} = ${JSON.stringify(request.value)}`
|
|
218
|
+
});
|
|
219
|
+
var resolutionNeed = (request) => request.flags.some((flag) => flag.judges === "resolved-options" && ownEntryOf({ options: request.config.options, option: flag.option }) === void 0) ? "needed" : "not-needed";
|
|
220
|
+
var hitsOf = (request) => {
|
|
221
|
+
const resolved = resolutionNeed(request) === "needed" ? request.resolution.resolve({ file: request.config.file }) : void 0;
|
|
222
|
+
return request.flags.flatMap((flag) => {
|
|
223
|
+
const own = ownEntryOf({ options: request.config.options, option: flag.option });
|
|
224
|
+
if (own !== void 0) return [presenceHit({ flag, value: own[1] })];
|
|
225
|
+
if (flag.judges === "own-options" || resolved === void 0) return [];
|
|
226
|
+
const snippet = judgedSnippet({ config: request.config, resolved, option: flag.option });
|
|
227
|
+
return snippet === void 0 ? [] : [{ clause: flag.address, anchor: FILE_ANCHOR, snippet }];
|
|
228
|
+
});
|
|
229
|
+
};
|
|
53
230
|
var createCompilerOverridesCheck = (options) => ({
|
|
54
|
-
prepare: ({ clauses }) => {
|
|
55
|
-
const
|
|
231
|
+
prepare: ({ clauses, repository, syntaxApi }) => {
|
|
232
|
+
const flags = selectedFlagsOf({ clauses });
|
|
233
|
+
const resolution = options.resolutionOf({ syntaxApi, disk: repository.disk });
|
|
56
234
|
return {
|
|
57
235
|
outcome: "ok",
|
|
58
236
|
value: {
|
|
@@ -61,27 +239,10 @@ var createCompilerOverridesCheck = (options) => ({
|
|
|
61
239
|
const text = readText();
|
|
62
240
|
if (text.outcome === "failed") return text;
|
|
63
241
|
const parsed = options.jsonc.parse({ source: text.value });
|
|
64
|
-
if (parsed.outcome === "failed") {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
69
|
-
return { outcome: "failed", error: { kind: "file-unparseable", file, detail: "configuration root must be an object" } };
|
|
70
|
-
}
|
|
71
|
-
if (!("compilerOptions" in config)) return { outcome: "ok", value: { kind: "complete", hits: [] } };
|
|
72
|
-
const compilerOptions = config.compilerOptions;
|
|
73
|
-
if (typeof compilerOptions !== "object" || compilerOptions === null || Array.isArray(compilerOptions)) {
|
|
74
|
-
return { outcome: "failed", error: { kind: "file-unparseable", file, detail: "compilerOptions must be an object" } };
|
|
75
|
-
}
|
|
76
|
-
const entries = Object.entries(compilerOptions);
|
|
77
|
-
const hits = selectedFlags.flatMap((flag) => {
|
|
78
|
-
const entry = entries.find(([key]) => key === flag.option);
|
|
79
|
-
return entry === void 0 ? [] : [{
|
|
80
|
-
clause: flag.address,
|
|
81
|
-
anchor: { line: 1, column: 0 },
|
|
82
|
-
snippet: `compilerOptions.${flag.option} = ${JSON.stringify(entry[1])}`
|
|
83
|
-
}];
|
|
84
|
-
});
|
|
242
|
+
if (parsed.outcome === "failed") return unparseable({ file, detail: parsed.error.detail });
|
|
243
|
+
const own = ownOptionsOf({ file, config: parsed.value });
|
|
244
|
+
if (own.outcome === "failed") return own;
|
|
245
|
+
const hits = hitsOf({ config: { file, options: own.value }, flags, resolution });
|
|
85
246
|
return { outcome: "ok", value: { kind: "complete", hits } };
|
|
86
247
|
},
|
|
87
248
|
finish: () => ({ outcome: "ok", value: [] })
|
|
@@ -89,7 +250,10 @@ var createCompilerOverridesCheck = (options) => ({
|
|
|
89
250
|
};
|
|
90
251
|
}
|
|
91
252
|
});
|
|
92
|
-
var check = createCompilerOverridesCheck({
|
|
253
|
+
var check = createCompilerOverridesCheck({
|
|
254
|
+
jsonc: createDefaultJsoncParsePort({ trailingCommas: "refused" }),
|
|
255
|
+
resolutionOf: typeScriptCompilerOptionsOf
|
|
256
|
+
});
|
|
93
257
|
export {
|
|
94
258
|
check,
|
|
95
259
|
createCompilerOverridesCheck
|
|
@@ -7,43 +7,71 @@
|
|
|
7
7
|
"clause": "strict",
|
|
8
8
|
"settings": {
|
|
9
9
|
"module": "compiler-overrides.js"
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
|
+
"editions": [
|
|
12
|
+
"1",
|
|
13
|
+
"2"
|
|
14
|
+
]
|
|
11
15
|
},
|
|
12
16
|
{
|
|
13
17
|
"clause": "no-unchecked-indexed-access",
|
|
14
18
|
"settings": {
|
|
15
19
|
"module": "compiler-overrides.js"
|
|
16
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"editions": [
|
|
22
|
+
"1",
|
|
23
|
+
"2"
|
|
24
|
+
]
|
|
17
25
|
},
|
|
18
26
|
{
|
|
19
27
|
"clause": "exact-optional-property-types",
|
|
20
28
|
"settings": {
|
|
21
29
|
"module": "compiler-overrides.js"
|
|
22
|
-
}
|
|
30
|
+
},
|
|
31
|
+
"editions": [
|
|
32
|
+
"1",
|
|
33
|
+
"2"
|
|
34
|
+
]
|
|
23
35
|
},
|
|
24
36
|
{
|
|
25
37
|
"clause": "no-implicit-override",
|
|
26
38
|
"settings": {
|
|
27
39
|
"module": "compiler-overrides.js"
|
|
28
|
-
}
|
|
40
|
+
},
|
|
41
|
+
"editions": [
|
|
42
|
+
"1",
|
|
43
|
+
"2"
|
|
44
|
+
]
|
|
29
45
|
},
|
|
30
46
|
{
|
|
31
47
|
"clause": "no-fallthrough-cases-in-switch",
|
|
32
48
|
"settings": {
|
|
33
49
|
"module": "compiler-overrides.js"
|
|
34
|
-
}
|
|
50
|
+
},
|
|
51
|
+
"editions": [
|
|
52
|
+
"1",
|
|
53
|
+
"2"
|
|
54
|
+
]
|
|
35
55
|
},
|
|
36
56
|
{
|
|
37
57
|
"clause": "no-property-access-from-index-signature",
|
|
38
58
|
"settings": {
|
|
39
59
|
"module": "compiler-overrides.js"
|
|
40
|
-
}
|
|
60
|
+
},
|
|
61
|
+
"editions": [
|
|
62
|
+
"1",
|
|
63
|
+
"2"
|
|
64
|
+
]
|
|
41
65
|
},
|
|
42
66
|
{
|
|
43
67
|
"clause": "use-unknown-in-catch-variables",
|
|
44
68
|
"settings": {
|
|
45
69
|
"module": "compiler-overrides.js"
|
|
46
|
-
}
|
|
70
|
+
},
|
|
71
|
+
"editions": [
|
|
72
|
+
"1",
|
|
73
|
+
"2"
|
|
74
|
+
]
|
|
47
75
|
}
|
|
48
76
|
]
|
|
49
77
|
}
|
|
@@ -10,7 +10,8 @@ The audit runner is Hone's standalone mechanism for checks that read a project's
|
|
|
10
10
|
|
|
11
11
|
## Files
|
|
12
12
|
|
|
13
|
-
- `walker-piece.ts` declares the contract a piece implements, `WalkerPiece`: a `prepare` call that receives the piece's selected clauses, the repository's tracked paths and TypeScript's API, and returns a prepared check with per-file `prepareFile` and a repository-wide `finish`.
|
|
13
|
+
- `walker-piece.ts` declares the contract a piece implements, `WalkerPiece`: a `prepare` call that receives the piece's selected clauses, the repository's tracked paths with a `disk` for reading files around them, such as a base config under `node_modules`, and TypeScript's API, and returns a prepared check with per-file `prepareFile` and a repository-wide `finish`.
|
|
14
|
+
- `walker-disk.ts` builds the `disk` a piece is handed: for a run, the real files under the repository root, untracked ones included, read through the file ports; for a conformance case, the case's texts in memory.
|
|
14
15
|
- `source-scope.ts` classifies a repository path as `generated` (under `node_modules`, `dist`, `build`, `coverage`, `.git`, or a root `vendor`) or `authored`, so every piece skips generated folders the same way.
|
|
15
16
|
- `walker-check-schema.ts` holds the schema for a clause's settings: `module`, a path inside the piece folder ending `.ts`, and optionally `escapingDirectives`, the TypeScript directives that escape the clause.
|
|
16
17
|
- `type-directives.ts` reads a comment as a TypeScript directive only where the compiler honours it, and turns each directive a clause lists into an `inline-disable` of that clause. A piece that judges directives reads them through it too.
|
|
@@ -35,6 +36,6 @@ The runner offers the piece every tracked path in the repository, and the piece
|
|
|
35
36
|
|
|
36
37
|
After every file, the prepared check's `finish` may return repository-wide hits, each naming its file. Every hit names one of the piece's selected clauses and carries a snippet the piece chooses.
|
|
37
38
|
|
|
38
|
-
`conform` runs each case of a clause's `discipline.json` as a one-file repository holding only that case
|
|
39
|
+
`conform` runs each case of a clause's `discipline.json` as a one-file repository holding only that case, whose `disk` holds only the case's file under the root `/repository`.
|
|
39
40
|
|
|
40
41
|
A piece that throws, or returns a value outside its schema, makes the run fail as `piece-invalid`. A piece that cannot parse a file returns a failed result whose error is `{ kind: "file-unparseable", file, detail }`, and the check stops with `load failure: runner-failed audit file-unparseable <file> <detail>`.
|