@hailstails/hone 1.3.0 → 1.5.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 +8 -8
- package/CHANGELOG.md +36 -0
- package/MIGRATING.md +40 -0
- package/README.md +28 -7
- package/api/audit.d.ts +1 -1
- package/api/testing.js +3 -3
- package/chunks/{chunk-H4V72FCW.js → chunk-2O46EB4E.js} +15 -1
- package/chunks/chunk-335ITLPO.js +7 -0
- package/chunks/{chunk-YSN46EB3.js → chunk-5U4VTFD5.js} +347 -664
- package/chunks/{chunk-PL2PNPAR.js → chunk-E6VR3VRV.js} +1 -6
- package/chunks/chunk-WF3PPYRR.js +27 -0
- package/core/check/tool-command.js +1120 -105
- package/core/mechanism-port/runner-result-types.d.ts +10 -0
- package/docs/adding-a-discipline-or-mechanism.md +5 -3
- package/docs/extending.md +2 -0
- package/docs/output-contract.md +64 -11
- package/mechanisms/audit/CD-27/test-body-logic.js +397 -46
- package/mechanisms/audit/runner/runner.js +5 -3
- package/mechanisms/audit/runner/typescript-parse.d.ts +2 -0
- package/mechanisms/audit/runner/walker-piece.d.ts +2 -1
- package/mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js +7 -4
- package/mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js +21 -11
- package/mechanisms/eslint/CD-14/cd14/cd14.eslint-plugin.js +15 -5
- package/mechanisms/eslint/CD-27/cd27/cd27.eslint-plugin.js +7 -3
- package/mechanisms/eslint/CD-41/README.md +1 -1
- package/mechanisms/eslint/CD-41/cd41/cd41.eslint-plugin.js +100 -28
- package/mechanisms/eslint/CD-42/cd42/cd42.eslint-plugin.js +8 -4
- package/mechanisms/eslint/CD-7/cd7/cd7.eslint-plugin.js +8 -4
- package/mechanisms/eslint/runner/README.md +9 -2
- package/mechanisms/eslint/runner/runner.js +1410 -1384
- package/methods/assessment-template.md +2 -2
- package/methods/lenses/clean-architecture.md +7 -8
- package/methods/lenses/defended-on-intent.md +2 -2
- package/methods/lenses/di-discipline.md +14 -18
- package/methods/lenses/function-first.md +16 -18
- package/methods/lenses/test-discipline.md +1 -1
- package/package.json +1 -1
- package/rules/CD-1/CHECKS.md +6 -2
- package/rules/CD-1/README.md +6 -19
- package/rules/CD-10/CHECKS.md +5 -3
- package/rules/CD-10/README.md +6 -18
- package/rules/CD-11/CHECKS.md +4 -2
- package/rules/CD-11/README.md +6 -16
- package/rules/CD-12/CHECKS.md +4 -2
- package/rules/CD-12/README.md +6 -16
- package/rules/CD-13/CHECKS.md +4 -2
- package/rules/CD-13/README.md +6 -16
- package/rules/CD-14/CHECKS.md +3 -1
- package/rules/CD-14/README.md +6 -19
- package/rules/CD-15/CHECKS.md +5 -1
- package/rules/CD-15/README.md +5 -20
- package/rules/CD-16/CHECKS.md +3 -1
- package/rules/CD-16/README.md +6 -6
- package/rules/CD-17/CHECKS.md +3 -1
- package/rules/CD-17/README.md +6 -19
- package/rules/CD-18/CHECKS.md +4 -2
- package/rules/CD-18/README.md +6 -16
- package/rules/CD-19/CHECKS.md +8 -6
- package/rules/CD-19/README.md +6 -20
- package/rules/CD-2/CHECKS.md +7 -3
- package/rules/CD-2/README.md +6 -21
- package/rules/CD-20/CHECKS.md +3 -1
- package/rules/CD-20/README.md +6 -6
- package/rules/CD-21/CHECKS.md +4 -2
- package/rules/CD-21/README.md +6 -15
- package/rules/CD-22/CHECKS.md +4 -2
- package/rules/CD-22/README.md +6 -15
- package/rules/CD-23/CHECKS.md +5 -3
- package/rules/CD-23/README.md +6 -17
- package/rules/CD-24/CHECKS.md +3 -1
- package/rules/CD-24/README.md +6 -6
- package/rules/CD-25/CHECKS.md +5 -3
- package/rules/CD-25/README.md +5 -21
- package/rules/CD-26/CHECKS.md +5 -3
- package/rules/CD-26/README.md +6 -20
- package/rules/CD-27/CHECKS.md +394 -9
- package/rules/CD-27/README.md +6 -20
- package/rules/CD-27/discipline.json +130 -0
- package/rules/CD-28/CHECKS.md +4 -2
- package/rules/CD-28/README.md +6 -16
- package/rules/CD-29/CHECKS.md +4 -2
- package/rules/CD-29/README.md +6 -14
- package/rules/CD-3/CHECKS.md +3 -1
- package/rules/CD-3/README.md +6 -17
- package/rules/CD-30/CHECKS.md +4 -2
- package/rules/CD-30/README.md +6 -15
- package/rules/CD-31/CHECKS.md +4 -2
- package/rules/CD-31/README.md +6 -14
- package/rules/CD-32/CHECKS.md +3 -1
- package/rules/CD-32/README.md +2 -0
- package/rules/CD-33/CHECKS.md +3 -1
- package/rules/CD-33/README.md +2 -0
- package/rules/CD-34/CHECKS.md +3 -1
- package/rules/CD-34/README.md +2 -0
- package/rules/CD-39/CHECKS.md +3 -1
- package/rules/CD-39/README.md +2 -0
- package/rules/CD-4/CHECKS.md +4 -2
- package/rules/CD-4/README.md +6 -17
- package/rules/CD-40/CHECKS.md +3 -1
- package/rules/CD-40/README.md +6 -20
- package/rules/CD-41/CHECKS.md +14 -2
- package/rules/CD-41/README.md +6 -20
- package/rules/CD-41/discipline.json +14 -0
- package/rules/CD-42/CHECKS.md +3 -1
- package/rules/CD-42/README.md +6 -16
- package/rules/CD-43/CHECKS.md +3 -1
- package/rules/CD-43/README.md +6 -18
- package/rules/CD-44/CHECKS.md +3 -1
- package/rules/CD-44/README.md +6 -17
- package/rules/CD-45/CHECKS.md +4 -2
- package/rules/CD-45/README.md +6 -16
- package/rules/CD-46/CHECKS.md +3 -1
- package/rules/CD-46/README.md +2 -0
- package/rules/CD-47/CHECKS.md +4 -2
- package/rules/CD-47/README.md +4 -20
- package/rules/CD-5/CHECKS.md +4 -2
- package/rules/CD-5/README.md +6 -19
- package/rules/CD-6/CHECKS.md +3 -1
- package/rules/CD-6/README.md +6 -19
- package/rules/CD-7/CHECKS.md +3 -1
- package/rules/CD-7/README.md +6 -20
- package/rules/CD-7a/CHECKS.md +3 -1
- package/rules/CD-7a/README.md +6 -17
- package/rules/CD-8/CHECKS.md +3 -1
- package/rules/CD-8/README.md +6 -17
- package/rules/CD-9/CHECKS.md +4 -2
- package/rules/CD-9/README.md +6 -17
- package/rules/README.md +71 -54
- package/rules/SPIRIT.md +3 -3
- package/rules/cases.md +94 -0
- package/rules/numbers.md +155 -0
- package/rules/principles.md +89 -0
- package/rules/records.md +150 -0
- package/rules/rules.md +149 -0
- package/rules/sources.md +142 -0
- package/rules/typescript/checks.md +219 -0
- package/rules/typescript/recipes.md +361 -0
- package/rules/typescript/symptoms.json +1005 -0
- package/rules/typescript/symptoms.md +612 -0
- package/chunks/chunk-YLZ73C7O.js +0 -0
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import type { Anchor } from "../values/anchor.js";
|
|
2
2
|
import type { ClauseAddress } from "../values/clause-address-types.js";
|
|
3
3
|
import type { RepoPath } from "../values/repo-path-types.js";
|
|
4
|
+
export type Remedy = {
|
|
5
|
+
readonly fix: string;
|
|
6
|
+
readonly page: string;
|
|
7
|
+
readonly section: string;
|
|
8
|
+
};
|
|
9
|
+
export type MeasuredPair = {
|
|
10
|
+
readonly clause: ClauseAddress;
|
|
11
|
+
readonly file: RepoPath;
|
|
12
|
+
};
|
|
4
13
|
export type Hit = {
|
|
5
14
|
readonly clause: ClauseAddress;
|
|
6
15
|
readonly file: RepoPath;
|
|
7
16
|
readonly anchor: Anchor;
|
|
8
17
|
readonly snippet: string;
|
|
18
|
+
readonly remedy?: Remedy;
|
|
9
19
|
};
|
|
@@ -67,7 +67,7 @@ For each mechanism in a clause's `mechanisms` list, add a piece folder `mechanis
|
|
|
67
67
|
`discipline` and `mechanism` must match the folder names, every `clause` must exist in the discipline, and no clause may appear twice. Core reads only this envelope. `settings` belongs to the runner, which parses it with its own schema:
|
|
68
68
|
|
|
69
69
|
- **audit:** `{ "module": "<file>.ts" }`, a path inside the piece folder; a `.js` module is accepted too, which is what the built package's pieces name. The module exports `check`, typed with `import type { WalkerPiece }` from `mechanisms/audit/runner/walker-piece.ts`. See `mechanisms/audit/runner/README.md`.
|
|
70
|
-
- **eslint:** `{ "pluginNamespace", "pluginModule", "rule" }`. `pluginModule` is a `.ts` or `.js` path inside the piece folder whose default export is an ESLint plugin; `rule` must be a key of its `rules`. The rule id is `<pluginNamespace>/<rule>`. The namespace `hone-core` is reserved for Hone's own machinery. The namespaces `hone` and `hone-*` belong to Hone's own rule set. A team rule set's pieces must use its rule-set name or `<ruleSet>-<name>`. Two selected clauses may not share a rule id, or a namespace with different plugin modules. CD-14's piece is `mechanisms/eslint/CD-14/piece.json`, pointing at the rule `no-class-authoring` in `cd14/cd14.eslint-plugin.ts` under the namespace `hone`.
|
|
70
|
+
- **eslint:** `{ "pluginNamespace", "pluginModule", "rule" }`. `pluginModule` is a `.ts` or `.js` path inside the piece folder whose default export is an ESLint plugin; `rule` must be a key of its `rules`. The rule id is `<pluginNamespace>/<rule>`. The namespace `hone-core` is reserved for Hone's own machinery. The namespaces `hone` and `hone-*` belong to Hone's own rule set. A team rule set's pieces must use its rule-set name or `<ruleSet>-<name>`. Two selected clauses may not share a rule id, or a namespace with different plugin modules. CD-14's piece is `mechanisms/eslint/CD-14/piece.json`, pointing at the rule `no-class-authoring` in `cd14/cd14.eslint-plugin.ts` under the namespace `hone`. A shipped piece writes each of its own rules with `siteRule` from `mechanisms/eslint/runner/rule-sites.ts`, which holds the mapping onto ESLint's listener keys (see the runner's README). A team rule set's piece stays a plain ESLint plugin.
|
|
71
71
|
|
|
72
72
|
A clause entry may also declare the settings a repository may tune, beside `settings`: `"clauseSettings": { "<key>": { "default": <JSON>, "choices": [<JSON>, ...] } }`. `choices` is optional; when given, every choice is the default's JSON kind and the default is one of them. Core reads these declarations itself, checks a repository's values from its `disciplines.json` against them when the check loads, and hands the piece the settled values, defaults included, as `clauseSettings` on each clause, typed `ClauseSettingValues`, apart from the mechanism's own `settings`. The `audit` and `rule-set` type entries carry no code, so a team's piece checks the shape of its `clauseSettings` itself, for example with its own schema, and returns `piece-invalid` when they do not match. No eslint piece declares `clauseSettings` yet, so a repository's settings for an eslint clause are refused when the check loads.
|
|
73
73
|
|
|
@@ -128,6 +128,8 @@ A runner whose tool comes from the adopting repository declares that tool as a p
|
|
|
128
128
|
|
|
129
129
|
Core loads `runner.ts` once per check and parses the export with its own schema (`core/mechanism-port/runner-module-schema.ts`). An unknown exception path, a missing member or a member that is not a function is the load failure `runner-invalid`. Core also parses everything a runner returns; a value outside its schema, a hit for a clause or file it was not asked about, or a call that throws or rejects is `runner-invalid-output`, and the check exits `2`. A runner reports its own failures as a `RunnerFailure` (`core/mechanism-port/runner-failure.ts`): `piece-invalid`, `tool-failed`, `file-unreadable`, `file-unparseable`, `plugin-conflict`, `team-config-unloadable`, `runner-invalid-output`, `toolchain-unavailable` or `toolchain-shadowed`.
|
|
130
130
|
|
|
131
|
+
Either kind of runner may also return `measured`: a list of `{ clause, file }` pairs, one for each clause it measured on each file. Only the mechanism knows this, so core infers none of it. A file the runner was handed and skipped has no pair, and neither does a run that did not happen. A pair for a clause or file the request did not hold is `runner-invalid-output`. `hone prune-debt` removes a stale or forfeited `file-carve-out` on a file that still exists only when its clause and file are among the pairs and no finding or native exception still holds them. A runner that returns no `measured` has measured nothing, so its debt on files that still exist stays for a person.
|
|
132
|
+
|
|
131
133
|
Use core's ports (`core/platform-ports/`) for files, module loading and paths, and wrap the tool itself in one factory file that is the only place the tool's package is imported. The audit mechanism's is `typescript-parse.ts`; the ESLint runner's is `eslint-toolchain.ts` (`eslint`, `@typescript-eslint/parser`, `@typescript-eslint/eslint-plugin` and `typescript`), with `inline-config-parser.ts` the only importer of `@eslint/plugin-kit`.
|
|
132
134
|
|
|
133
135
|
### 2. Choose an exception path
|
|
@@ -181,13 +183,13 @@ The ESLint runner's map. "Checked file" means a tracked `.ts`, `.tsx`, `.mts` or
|
|
|
181
183
|
| ESLint native channel | Exception kind | Can a record cover it? |
|
|
182
184
|
| --- | --- | --- |
|
|
183
185
|
| a checked file the team's configuration ignores (for example a global `ignores` block); reported for every selected clause | `ignore` | no |
|
|
184
|
-
| a checked file on which the team's resolved configuration leaves a selected rule below `"error"` (`"warn"`, `"off"` or not set) | `config-override` | yes |
|
|
186
|
+
| a checked file on which the team's resolved configuration leaves a selected rule below `"error"` (`"warn"`, `"off"` or not set), unless a record projects that rule off for that file | `config-override` | yes |
|
|
185
187
|
| an entry for a selected rule in any tracked file named `eslint-suppressions.json`, or in a file named by `--suppressions-location` in a tracked `package.json` script | `suppression-entry` | no |
|
|
186
188
|
| an `eslint-disable`, `eslint-disable-line` or `eslint-disable-next-line` comment naming a selected rule, or naming no rule, which escapes every selected clause and is reported once for each | `inline-disable` | yes, by a file record on its clause and file |
|
|
187
189
|
| an `/* eslint ... */` comment configuring a selected rule, or one that cannot be parsed | `inline-rule-config` | no |
|
|
188
190
|
| an option in an ESLint invocation in a tracked `package.json` script that weakens or replaces a selected rule's configuration: `--rule` or `--suppress-rule` naming it, or `--suppress-all`, `--no-config-lookup`, `--parser`, `--parser-options` or `--plugin`; `-c`/`--config` or `--ignore-pattern`, unless the script's own folder settles that it changes nothing | `command-line-option` | no |
|
|
189
191
|
|
|
190
|
-
The ESLint runner declares `projectedKinds: ["config-override", "inline-disable"]`, because a file record's projection block turns the rule off for that file whatever its comments say. A record covers a `config-override` on its own file (authorised location or file carve-out) or on every file (clause-wide carve-out), and an `inline-disable` on its own file only.
|
|
192
|
+
The ESLint runner declares `projectedKinds: ["config-override", "inline-disable"]`, because a file record's projection block turns the rule off for that file whatever its comments say. A record covers a `config-override` on its own file (authorised location or file carve-out) or on every file (clause-wide carve-out), and an `inline-disable` on its own file only. The runner does not report a `config-override` on a clause and file that a record projects off, forfeited or not: while the projection is in effect it is spread last and enables every selected rule at `"error"`, so a rule below `"error"` there is the projection's own off-switch. That off-switch never counts as a native exception the record holds, so a record whose file no longer breaks its clause is `stale`.
|
|
191
193
|
|
|
192
194
|
How the runner finds each channel (`mechanisms/eslint/runner/`):
|
|
193
195
|
|
package/docs/extending.md
CHANGED
|
@@ -224,7 +224,9 @@ export const check: WalkerPiece = {
|
|
|
224
224
|
|
|
225
225
|
- `module` is a path inside the piece folder, and the module exports `check`.
|
|
226
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
|
+
- `prepareFile` answers `skipped` for a file the piece does not judge. Any other answer, `complete` with no hits included, says the piece's clauses were measured on that file: the runner reports each as a `measured` pair, and `hone prune-debt` removes a stale or forfeited `file-carve-out` on that clause and file. The example answers `complete` for every file because it judges every file by its name; a piece that judges only TypeScript sources answers `skipped` for a `.md` or `.js` file.
|
|
227
228
|
- A hit passes back the clause's `address` unchanged, a 1-based line and 0-based column, and a short snippet.
|
|
229
|
+
- A hit may also give a `remedy` (the type is `Remedy` from `@hailstails/hone/audit`): a `fix` naming what to write instead of the form it flagged, the `page` that shows it as a path inside the rule's folder (`rules/<ID>/`), such as `CHECKS.md` or `README.md`, and the `section` of that page, as lowercase letters, digits and hyphens. Core resolves the page to the path a reader opens, as it does for the rule page under `readFirst`, and the finding then ends with ` fix: <fix> (<fix page>#<section>)`; see [the output contract](output-contract.md#report-lines).
|
|
228
230
|
- 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
231
|
- 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>`.
|
|
230
232
|
- To read JSON with comments, such as a `tsconfig.json`, call TypeScript's own parser on the syntax API: `syntaxApi.parseConfigFileTextToJson(file, text)` returns the parsed value as `config` and sets `error` when it cannot parse the text. A piece does not import a JSON parser of its own; see [What is stable](#what-is-stable).
|
package/docs/output-contract.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# Output contract
|
|
2
2
|
|
|
3
|
-
This page lists everything the `hone` command prints, exactly as it prints it: the help, the version, the report, the load failures, the `hone project` lines, the `hone record-debt` lines and the `hone split-records` lines. It says which parts a hook, CI job or agent can parse and rely on. [Compatibility](../README.md#compatibility) says which releases may change them.
|
|
3
|
+
This page lists everything the `hone` command prints, exactly as it prints it: the help, the version, the report, the load failures, the `hone project` lines, the `hone record-debt` lines, the `hone prune-debt` lines and the `hone split-records` lines. It says which parts a hook, CI job or agent can parse and rely on. [Compatibility](../README.md#compatibility) says which releases may change them.
|
|
4
4
|
|
|
5
5
|
A test renders every kind of line the command can print, fills each template below with that line's own sample values, and requires the result to equal the printed line exactly: a line Hone can print that is not listed here fails the build, and so does a line listed here that Hone cannot print. The synopsis and help blocks below are compared with what the command prints, character for character.
|
|
6
6
|
|
|
7
7
|
## Streams and exit codes
|
|
8
8
|
|
|
9
|
-
Hone prints everything to standard output: the report, the help, the version, `hone project`, `hone record-debt` and `hone split-records` lines and every load failure, including an error Hone did not expect. Hone writes nothing to standard error itself; Node can write its own warnings there, so a hook should not read output on standard error as a failure.
|
|
9
|
+
Hone prints everything to standard output: the report, the help, the version, `hone project`, `hone record-debt`, `hone prune-debt` and `hone split-records` lines and every load failure, including an error Hone did not expect. Hone writes nothing to standard error itself; Node can write its own warnings there, so a hook should not read output on standard error as a failure.
|
|
10
10
|
|
|
11
11
|
The exit code is the signal a hook should act on:
|
|
12
12
|
|
|
13
|
-
- `0`: `hone check` printed `verdict: pass` or `verdict: pass (partial assessment)`, `hone project` wrote or confirmed every projection, `hone record-debt` wrote every record it needed or needed none, `hone split-records` split the records or found nothing to split, or help or the version was printed;
|
|
13
|
+
- `0`: `hone check` printed `verdict: pass` or `verdict: pass (partial assessment)`, `hone project` wrote or confirmed every projection, `hone record-debt` wrote every record it needed or needed none, `hone prune-debt` removed every paid record or found none, `hone split-records` split the records or found nothing to split, or help or the version was printed;
|
|
14
14
|
- `1`: `hone check` printed `verdict: fail` or `verdict: fail (partial assessment)` as its last line. Exit `1` always comes with one of those lines, and with nothing else;
|
|
15
|
-
- `2`: Hone could not decide. It printed exactly one line, starting with `load failure: `, and no verdict. That covers a command typed wrongly, an input that could not be loaded, a mechanism that failed, records `hone record-debt` or `hone split-records` could not write or place, and an error Hone did not expect, which prints as `unexpected-error`.
|
|
15
|
+
- `2`: Hone could not decide. It printed exactly one line, starting with `load failure: `, and no verdict. That covers a command typed wrongly, an input that could not be loaded, a mechanism that failed, records `hone record-debt`, `hone prune-debt` or `hone split-records` could not write or place, and an error Hone did not expect, which prints as `unexpected-error`.
|
|
16
16
|
|
|
17
17
|
A 1.0 hook can rely on this: run `hone check`, block on any non-zero exit, and show standard output as it came.
|
|
18
18
|
|
|
@@ -35,6 +35,7 @@ These are not stable, so a minor release may change them:
|
|
|
35
35
|
- the wording after `load failure: arguments-invalid`, written for the person who typed the command;
|
|
36
36
|
- the text after a load failure's values, which says what to do next: the repair text of `selection-absent`, `judgement-clause-listed`, `config-root-untracked` and `why-chains-required`, and everything after the kind in `toolchain-unavailable` and `toolchain-shadowed`;
|
|
37
37
|
- the `readFirst` lines and their leading note, written for a person;
|
|
38
|
+
- the words of a finding's `<fix>`, and which `<fix page>` and `<section>` it names;
|
|
38
39
|
- the words of an `unmeasured` or `projectionProblems` line after the `:` that ends its leading fields (its kind and reason, or its mechanism, state and slice), which say why and what to do next;
|
|
39
40
|
- the words of a `hone record-debt` line after the `:` that follows its file, which say why no record was written and what to do instead.
|
|
40
41
|
|
|
@@ -53,18 +54,25 @@ In the tables below, a word in angle brackets, such as `<clause>`, stands for a
|
|
|
53
54
|
| `<count>`, `<index>`, `<earlier index>` | a whole number; an index counts from 0, within the file that holds the record | never |
|
|
54
55
|
| `<version>` | the installed package's version | never |
|
|
55
56
|
| `<edition>`, `<latest>` | the edition of a clause's check that ran and the latest edition its piece declares, each a whole number from 1 | never |
|
|
56
|
-
| `<file>`, `<path>`, `<records file>`, `<earlier records file>`, `<records folder>`, `<slice>`, `<suppressions file>`, `<package file>`, `<config root>`, `<piece folder>`, `<location>`, `<install folder>`, `<rule page>`, `<adoption guide>` | a path, as described below | may hold a space |
|
|
57
|
+
| `<file>`, `<path>`, `<records file>`, `<earlier records file>`, `<records folder>`, `<slice>`, `<suppressions file>`, `<package file>`, `<config root>`, `<piece folder>`, `<location>`, `<install folder>`, `<rule page>`, `<adoption guide>`, `<symptom page>` | a path, as described below | may hold a space |
|
|
57
58
|
| `<folders>` | paths separated by `, ` | may hold a space |
|
|
58
59
|
| `<folder>` | the folder that holds a `<slice>` | may hold a space |
|
|
59
60
|
| `<project command>` | the command that runs `hone project` for this repository: `node`, the installed command's absolute path, `project --repo` and the repository's absolute path, each path with forward slashes and in double quotes when it holds a character other than a letter, digit or one of `_ . / @ : + -` | may hold a space |
|
|
61
|
+
| `<prune command>` | the command that runs `hone prune-debt` for this repository: like `<project command>` with `prune-debt` in place of `project`, followed by `--base-revision` and `--forfeiture` with their values when the check was given them, each value written as a path is | may hold a space |
|
|
60
62
|
| `<revision>`, `<git message>` | the `--base-revision` value as given and what git said, each as a JSON string in double quotes | may hold a space |
|
|
61
63
|
| `<dir>` | the `--repo` value as typed | may hold a space |
|
|
62
64
|
| `<url>` | the module URL Hone could not resolve, as given | may hold a space |
|
|
63
65
|
| `<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 |
|
|
66
|
+
| `<fix>` | what to write instead of the form a finding flags, as the clause's piece words it | may hold a space |
|
|
67
|
+
| `<symptom>` | a symptom's name in the installed symptom catalogue, which is also its heading's anchor on `<symptom page>`: lowercase letters, digits and hyphens | never |
|
|
68
|
+
| `<indicated>` | the names of the rules and principles the symptom may indicate, in the catalogue's order, each once, separated by `, ` | may hold a space |
|
|
69
|
+
| `<title>`, `<indications>`, `<breach>`, `<recipe>`, `<recipes>`, `<answers>` | the symptom's title; each case it may indicate, lowercased at its start, with ` → ` and the titles it points at separated by `, `, the cases separated by `; `; where its breach usually sits; its recipe's title, or its recipes' titles separated by `; `; and one sentence for each correct use the symptom has, then one for known debt, which every symptom takes: the situation, capitalised, then `: `, the record kind that expresses it, where it sits when the catalogue says, and in brackets that kind's format today or `no record format yet`, the sentences separated by `. ` | may hold a space |
|
|
70
|
+
| `<fix page>` | the page in the clause's rule folder that its piece names for a fix, such as that rule's `CHECKS.md`, as a path described below | may hold a space |
|
|
71
|
+
| `<section>` | the section of `<fix page>` that shows that form and what to write instead: lowercase letters, digits and hyphens | never |
|
|
64
72
|
| `<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
73
|
| `<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
74
|
|
|
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.
|
|
75
|
+
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>`, a `<fix 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.
|
|
68
76
|
|
|
69
77
|
## Commands
|
|
70
78
|
|
|
@@ -72,6 +80,7 @@ Paths are printed with forward slashes. A path inside the `--repo` folder is pri
|
|
|
72
80
|
hone check --repo <dir> [--base-revision <revision>] [--report-output <full|failures-only|counts|verdict-only>] [--forfeiture <this-run|elsewhere>]
|
|
73
81
|
hone project --repo <dir>
|
|
74
82
|
hone record-debt --repo <dir> --base-revision <revision> [--leave <path>]...
|
|
83
|
+
hone prune-debt --repo <dir> [--base-revision <revision>] [--forfeiture <this-run|elsewhere>]
|
|
75
84
|
hone split-records --repo <dir>
|
|
76
85
|
hone --help
|
|
77
86
|
hone --version
|
|
@@ -90,6 +99,7 @@ commands:
|
|
|
90
99
|
check check the repository against the disciplines it selects and print the report, ending in its verdict
|
|
91
100
|
project write the native configuration each selected embedded mechanism needs, printing each file as written or unchanged
|
|
92
101
|
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
|
|
102
|
+
prune-debt remove from the exception records each stale or forfeited file carve-out whose file no longer exists or whose clause its mechanism measured on that file with nothing left to hold it, printing each pair removed
|
|
93
103
|
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
104
|
|
|
95
105
|
options:
|
|
@@ -164,6 +174,28 @@ exit codes:
|
|
|
164
174
|
2 a load failure: an input could not be loaded, a mechanism failed, the records could not be written, or Hone failed unexpectedly
|
|
165
175
|
```
|
|
166
176
|
|
|
177
|
+
`hone prune-debt --help` prints:
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
usage: hone prune-debt --repo <dir> [--base-revision <revision>] [--forfeiture <this-run|elsewhere>]
|
|
181
|
+
|
|
182
|
+
remove from the exception records each stale or forfeited file carve-out whose file no longer exists or whose clause its mechanism measured on that file with nothing left to hold it, printing each pair removed
|
|
183
|
+
|
|
184
|
+
options:
|
|
185
|
+
--repo <dir>
|
|
186
|
+
the folder that holds disciplines.json, usually the repository root
|
|
187
|
+
--base-revision <revision>
|
|
188
|
+
the revision the change is measured from; without it no file carve-out can be forfeited
|
|
189
|
+
--forfeiture <this-run|elsewhere>
|
|
190
|
+
assess file carve-out decay in this run or leave it to another, over assessment.forfeiture in disciplines.json; this-run when neither is set
|
|
191
|
+
--help, -h
|
|
192
|
+
print this help
|
|
193
|
+
|
|
194
|
+
exit codes:
|
|
195
|
+
0 every paid record was removed, or none was paid
|
|
196
|
+
2 a load failure: an input could not be loaded, a mechanism failed, the records could not be written, or Hone failed unexpectedly
|
|
197
|
+
```
|
|
198
|
+
|
|
167
199
|
`hone split-records --help` prints:
|
|
168
200
|
|
|
169
201
|
```text
|
|
@@ -209,7 +241,7 @@ exit codes:
|
|
|
209
241
|
| `unmeasured` | failing | what this run could not measure |
|
|
210
242
|
| `projectionProblems` | failing | ESLint projections that are out of date |
|
|
211
243
|
| `assessment` | informational | concerns this run left to another run |
|
|
212
|
-
| `readFirst` | guidance | where to read before changing code, for each clause with findings |
|
|
244
|
+
| `readFirst` | guidance | where to read before changing code, for each clause with findings, and the command that removes recorded debt that is paid |
|
|
213
245
|
|
|
214
246
|
`--report-output`, or `reportOutput` in `disciplines.json`, sets how much is printed. The verdict and the exit code are the same in every output.
|
|
215
247
|
|
|
@@ -236,7 +268,7 @@ The verdict line reads `(partial assessment)` whenever the report has an `assess
|
|
|
236
268
|
|
|
237
269
|
## Report lines
|
|
238
270
|
|
|
239
|
-
Each section's entries take one of these shapes. An exempted finding repeats ` exempted by <record kind>` once for each exception that covers it. In `projectionProblems`, a `<slice>` is the `disciplines.eslint.mjs` projection file of one config root, the repository root or a folder in `eslintConfigRoots`; `unconfigured` means that root has no `eslint.config.*`.
|
|
271
|
+
Each section's entries take one of these shapes. A finding names its symptom with ` symptom: <symptom>, may indicate: <indicated>` after the snippet when the installed symptom catalogue reads one for its clause, and for `CD-27#test-body-logic` for the form it flagged; a finding the catalogue reads no symptom for prints without it. A finding ends with ` fix: <fix> (<fix page>#<section>)` when its clause's piece names what to write instead of the form it flagged and the page that shows it, as `CD-27#test-body-logic` does; an exempted finding never carries either. An exempted finding repeats ` exempted by <record kind>` once for each exception that covers it. In `projectionProblems`, a `<slice>` is the `disciplines.eslint.mjs` projection file of one config root, the repository root or a folder in `eslintConfigRoots`; `unconfigured` means that root has no `eslint.config.*`.
|
|
240
272
|
|
|
241
273
|
| Section | Line |
|
|
242
274
|
| --- | --- |
|
|
@@ -245,6 +277,9 @@ Each section's entries take one of these shapes. An exempted finding repeats ` e
|
|
|
245
277
|
| `notRun` | `<clause> adopted, mechanism not run: enforced by review` |
|
|
246
278
|
| `editions` | `<clause> <mechanism> edition <edition> of <latest>` |
|
|
247
279
|
| `findings` | `<clause> <mechanism> <file>:<line>:<column> <snippet>` |
|
|
280
|
+
| `findings` | `<clause> <mechanism> <file>:<line>:<column> <snippet> fix: <fix> (<fix page>#<section>)` |
|
|
281
|
+
| `findings` | `<clause> <mechanism> <file>:<line>:<column> <snippet> symptom: <symptom>, may indicate: <indicated>` |
|
|
282
|
+
| `findings` | `<clause> <mechanism> <file>:<line>:<column> <snippet> symptom: <symptom>, may indicate: <indicated> fix: <fix> (<fix page>#<section>)` |
|
|
248
283
|
| `exempted` | `<clause> <mechanism> <file>:<line>:<column> <snippet> exempted by <record kind>` |
|
|
249
284
|
| `exempted` | `<clause> <mechanism> <file>:<line>:<column> <snippet> exempted by <record kind> imported from <source>` |
|
|
250
285
|
| `uncovered` | `<clause>` |
|
|
@@ -301,6 +336,12 @@ Each section's entries take one of these shapes. An exempted finding repeats ` e
|
|
|
301
336
|
| `projectionProblems` | `<mechanism> unconfigured <slice>: <folder> has no <mechanism> configuration file on disk, so nothing loads that slice; run the tool that generates it (for sku, sku configure) before the check` |
|
|
302
337
|
| `assessment` | `forfeiture elsewhere: 1 file carve-out not checked for decay in this run` |
|
|
303
338
|
| `assessment` | `forfeiture elsewhere: <count> file carve-outs not checked for decay in this run` |
|
|
339
|
+
| `readFirst` | `<symptom>: <title>. May indicate: <indications>. The breach usually sits <breach>. Recipe: <recipe>. <answers>. Read <symptom page>#<symptom>` |
|
|
340
|
+
| `readFirst` | `<symptom>: <title>. May indicate: <indications>. The breach usually sits <breach>. Recipes: <recipes>. <answers>. Read <symptom page>#<symptom>` |
|
|
341
|
+
| `readFirst` | `<symptom>: <title>. May indicate: <indications>. The breach usually sits <breach>. <answers>. Read <symptom page>#<symptom>` |
|
|
342
|
+
| `readFirst` | `symptom catalogue not read, so no finding names its symptom: file-unreadable <path> <detail>` |
|
|
343
|
+
| `readFirst` | `symptom catalogue not read, so no finding names its symptom: file-malformed <path> <detail>` |
|
|
344
|
+
| `readFirst` | `symptom catalogue not read, so no finding names its symptom: unsupported-version <path> <version found>` |
|
|
304
345
|
| `readFirst` | `Start from each rule's Spirit below. disciplines.assessment.md, where this repository records its own causes, forward goal and steps for a clause, is not written yet; <adoption guide>#5a-write-the-assessment says how to write it.` |
|
|
305
346
|
| `readFirst` | `disciplines.assessment.md, where this repository records its own causes, forward goal and steps for a clause, is not written yet; <adoption guide>#5a-write-the-assessment says how to write it.` |
|
|
306
347
|
| `readFirst` | `Start from each rule's Spirit below. disciplines.assessment.md could not be read.` |
|
|
@@ -311,8 +352,12 @@ Each section's entries take one of these shapes. An exempted finding repeats ` e
|
|
|
311
352
|
| `readFirst` | `<clause>: read the "## <clause>" section of disciplines.assessment.md; its rule set has no rule page at <rule page>` |
|
|
312
353
|
| `readFirst` | `<clause>: its rule set has no rule page at <rule page>; disciplines.assessment.md does not assess this clause` |
|
|
313
354
|
| `readFirst` | `<clause>: its rule set has no rule page at <rule page>` |
|
|
355
|
+
| `readFirst` | `prune-debt: 1 file carve-out under stale or forfeited still records debt that is paid; run <prune command> to remove what is paid, and commit the exception records it changes` |
|
|
356
|
+
| `readFirst` | `prune-debt: <count> file carve-outs under stale or forfeited still record debt that is paid; run <prune command> to remove what is paid, and commit the exception records it changes` |
|
|
357
|
+
| `readFirst` | `prune-debt: 1 file carve-out under stale or forfeited still records debt that is paid; run <prune command> to remove what is paid, then run <project command> and commit the exception records with every disciplines.<mechanism>.mjs it writes` |
|
|
358
|
+
| `readFirst` | `prune-debt: <count> file carve-outs under stale or forfeited still record debt that is paid; run <prune command> to remove what is paid, then run <project command> and commit the exception records with every disciplines.<mechanism>.mjs it writes` |
|
|
314
359
|
|
|
315
|
-
`readFirst` has one clause line per clause with findings, in the order the findings first name them. When `disciplines.assessment.md` is not written yet, or cannot be read, one note line comes
|
|
360
|
+
`readFirst` opens with one symptom line per symptom a finding names, in the order the findings first name them, each printed once however many findings name it. It names the symptom's cases with the rules and principles each may indicate, where the breach usually sits, its recipe or recipes when it has any, each correct use it has and the kind of record that expresses it, then known debt, which debt answers for every symptom, each with that kind's record format today. When the symptom catalogue cannot be read, `readFirst` opens instead with one line that says so and why; the findings then print as they would with no catalogue, and the verdict and exit code are those the findings decide. `readFirst` then has one clause line per clause with findings, in the order the findings first name them, then, last, one `prune-debt` line when any `file-carve-out` under `stale` or `forfeited` is one `hone prune-debt` would remove. It names `hone project` too when any of those records is for a clause whose mechanism, such as `eslint`, puts records into effect through a projection, and then names each such mechanism's projection file, joined by ` and every `. When `disciplines.assessment.md` is not written yet, or cannot be read, one note line comes after the symptom lines and before the clause lines; it starts with `Start from each rule's Spirit below.` only when at least one clause line names a rule page. A clause line's first word is a clause address, which holds a `#`, followed by `:`; a note line's first word holds no `#`, which is how a tool tells them apart. A symptom line is a note line whose first word is its symptom's name followed by `:`. The `<adoption guide>` is `ADOPTING.md` in the installed package, such as `node_modules/@hailstails/hone/ADOPTING.md`. A clause line names the clause's section in `disciplines.assessment.md` when the file has one, says `does not assess this clause` when the file is there without that section, and says neither when the file is not read. [The README](../README.md#commands) says how a section is matched.
|
|
316
361
|
|
|
317
362
|
## Load failures
|
|
318
363
|
|
|
@@ -366,8 +411,8 @@ An `arguments-invalid` line says what was wrong with the command as typed. Its w
|
|
|
366
411
|
|
|
367
412
|
| Problem | Line |
|
|
368
413
|
| --- | --- |
|
|
369
|
-
| `command-missing` | `load failure: arguments-invalid hone needs a command, check, project, record-debt or split-records; run hone --help for usage` |
|
|
370
|
-
| `command-unknown` | `load failure: arguments-invalid hone has no command "<given>"; its commands are check, project, record-debt and split-records; run hone --help for usage` |
|
|
414
|
+
| `command-missing` | `load failure: arguments-invalid hone needs a command, check, project, record-debt, prune-debt or split-records; run hone --help for usage` |
|
|
415
|
+
| `command-unknown` | `load failure: arguments-invalid hone has no command "<given>"; its commands are check, project, record-debt, prune-debt and split-records; run hone --help for usage` |
|
|
371
416
|
| `flag-extra` | `load failure: arguments-invalid hone <flag> takes nothing after it, not "<given>"; run hone --help for usage` |
|
|
372
417
|
| `argument-unexpected` | `load failure: arguments-invalid hone <command> takes options, not "<given>" on its own; give each option and its value as two arguments, as in <option> <value>; run hone <command> --help for its options` |
|
|
373
418
|
| `option-unknown` | `load failure: arguments-invalid hone <command> has no option "<given>"; run hone <command> --help for its options` |
|
|
@@ -404,6 +449,14 @@ An `arguments-invalid` line says what was wrong with the command as typed. Its w
|
|
|
404
449
|
| `record-debt` | `<clause> refused <file>: the clause's discipline refuses exceptions; fix it` |
|
|
405
450
|
| `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` |
|
|
406
451
|
|
|
452
|
+
## hone prune-debt
|
|
453
|
+
|
|
454
|
+
`hone prune-debt` runs the check with the `--base-revision` and `--forfeiture` it is given, then removes from the exception records each `file-carve-out` the check lists under `stale` or `forfeited` whose file no longer exists or whose clause and file its mechanism reported as `measured`, unless its clause and file still hold a finding that no record answers, a finding that only debt exempts, or any native exception, recorded or not. A finding an `authorised-location` in force exempts is answered and does not keep the record; a `clause-wide-carve-out` is not an answer. An imported `authorised-location` or one with a legacy why-chain answers nothing on a run whose exception baseline is unmeasured, since that run accepted it without judging it at the base revision, so an unmeasured baseline removes nothing on such an answer. A `file-carve-out` in force beside an `authorised-location` on the same clause and file is listed under `doublyHeld`, not `stale` or `forfeited`, so the command removes neither. It works in whichever [layout](../README.md#the-split-layout) the repository keeps the records in, and prints one line for each clause and file it removed, ordered by file and then by clause. It leaves every other record for a person: a stale or forfeited `file-carve-out` on a file that still exists and that its mechanism did not measure, such as a file the mechanism skips, and an `authorised-location` or `clause-wide-carve-out` under `stale`. It prints nothing when it removed none. It does not write the projection: with an `eslint` clause, run `hone project` after it, as the `readFirst` line says. The text of every other record in a file it changes is kept byte for byte. In the split layout, a rule's file left with no records is deleted; a single `discipline-exceptions.json` left with none holds an empty list.
|
|
455
|
+
|
|
456
|
+
| Output | Line |
|
|
457
|
+
| --- | --- |
|
|
458
|
+
| `prune-debt` | `<clause> removed <file>` |
|
|
459
|
+
|
|
407
460
|
## hone split-records
|
|
408
461
|
|
|
409
462
|
`hone split-records` moves a repository's exception records from `discipline-exceptions.json` into the `discipline-exceptions` folder. It prints a `written` line for each file it writes, in path order, then a `removed` line for `discipline-exceptions.json`. When the records are already split, or `discipline-exceptions.json` is absent or holds no records, it prints one line, changes nothing and exits `0`. A records file that holds a record whose clause names no discipline, or keys other than `version` and `exceptions`, is `records-unsplittable`, and nothing is written.
|