@hailstails/hone 1.4.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 +14 -0
- package/MIGRATING.md +17 -0
- package/README.md +10 -10
- package/api/testing.js +2 -2
- package/chunks/{chunk-FEWCJU7H.js → chunk-2O46EB4E.js} +6 -0
- package/chunks/{chunk-6SM3HKWO.js → chunk-5U4VTFD5.js} +88 -51
- package/core/check/tool-command.js +379 -56
- package/core/mechanism-port/runner-result-types.d.ts +4 -0
- package/docs/adding-a-discipline-or-mechanism.md +2 -0
- package/docs/extending.md +1 -0
- package/docs/output-contract.md +17 -6
- package/mechanisms/audit/CD-27/test-body-logic.js +5 -2
- package/mechanisms/audit/runner/runner.js +5 -3
- package/mechanisms/eslint/runner/runner.js +7 -3
- 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 +10 -13
- package/methods/lenses/function-first.md +16 -18
- package/package.json +1 -1
- package/rules/CD-1/CHECKS.md +4 -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 +3 -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 +5 -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 +3 -1
- 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 +16 -7
- package/rules/CD-27/README.md +6 -20
- 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 +4 -2
- package/rules/CD-41/README.md +6 -22
- 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/rules/CD-23/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-23 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Unit without a running test](../typescript/symptoms.md#unit-without-a-running-test).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
|
@@ -24,11 +26,11 @@ This is `src/price.ts` with no `src/price.test.ts` beside it.
|
|
|
24
26
|
Add `src/price.test.ts` next to the file, with at least one test of its behaviour.
|
|
25
27
|
|
|
26
28
|
## Exceptions
|
|
27
|
-
Add an entry to `discipline-exceptions.json` at the repository root. Use `
|
|
29
|
+
Add an entry to `discipline-exceptions.json` at the repository root. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. The form accepts an `authorised-location` for this clause, as for any; in spirit a unit that only wires has a test of its wiring, and a reviewer refuses one. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
|
|
28
30
|
|
|
29
31
|
```json
|
|
30
32
|
{ "version": 1, "exceptions": [
|
|
31
|
-
{ "kind": "
|
|
33
|
+
{ "kind": "file-carve-out", "clause": "CD-23#export-test-sibling", "file": "src/legacy/report.ts" }
|
|
32
34
|
] }
|
|
33
35
|
```
|
|
34
36
|
|
package/rules/CD-23/README.md
CHANGED
|
@@ -2,25 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
7
|
+
**Verdict.** Keeps: [Tested where it's owned](../rules.md#tested-where-its-owned).
|
|
10
8
|
|
|
11
|
-
**
|
|
9
|
+
**Read.** [Tested where it's owned](../rules.md#tested-where-its-owned) and [Companion test file](../typescript/recipes.md#companion-test-file).
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- *A unit too tangled to test.* The test was skipped because the unit reaches its dependencies directly. Inject them, and the unit can be tested alone.
|
|
15
|
-
- *A file that is not a unit.* It holds loose pieces with no single purpose. Split it into units that each have one.
|
|
16
|
-
- *Tests in a parallel tree.* The tests exist but live elsewhere and drift. Move each beside its unit.
|
|
17
|
-
- *Tested only through something bigger.* The unit is covered only by an integration test. Give it its own.
|
|
18
|
-
|
|
19
|
-
**Where to go.** Every unit has a sibling test that states what it is for, and the two are edited together.
|
|
11
|
+
Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
- "It's covered by the integration tests." Covered is not specified. A failure there does not say which unit broke.
|
|
23
|
-
- "It's too simple to test." Then the test is short. It still states the purpose.
|
|
13
|
+
## Spirit
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
- *Listen to the tests* (Steve Freeman and Nat Pryce, *Growing Object-Oriented Software, Guided by Tests*). Difficulty testing a unit is feedback about its design.
|
|
15
|
+
Start from the symptom a finding names: [Unit without a running test](../typescript/symptoms.md#unit-without-a-running-test). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
|
package/rules/CD-24/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-24 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Unit without a running test](../typescript/symptoms.md#unit-without-a-running-test).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
6
|
|
|
5
7
|
## How it is checked
|
|
6
8
|
|
package/rules/CD-24/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
|
+
|
|
7
|
+
**Verdict.** Merges with CD-23.
|
|
8
|
+
|
|
9
|
+
**Read.** [Tested where it's owned](../rules.md#tested-where-its-owned) and [Companion test file](../typescript/recipes.md#companion-test-file).
|
|
10
10
|
|
|
11
11
|
Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
12
12
|
|
|
13
13
|
## Spirit
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Start from the symptom a finding names: [Unit without a running test](../typescript/symptoms.md#unit-without-a-running-test). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
|
package/rules/CD-25/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-25 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Double with a body](../typescript/symptoms.md#double-with-a-body).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
package/rules/CD-25/README.md
CHANGED
|
@@ -2,30 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Verdict.** Keeps: [Written-out answers](../rules.md#written-out-answers).
|
|
8
|
+
|
|
9
|
+
**Read.** [Written-out answers](../rules.md#written-out-answers) and [Stub with vi.fn](../typescript/recipes.md#stub-with-vifn).
|
|
8
10
|
|
|
9
11
|
Review lens: [di-discipline](../../methods/lenses/di-discipline.md), [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
10
12
|
|
|
11
13
|
## Spirit
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
**What a finding points at.** Match the sites against these causes.
|
|
16
|
-
- *A seam wider than its use.* The double needs logic because the port does many things or takes rich input. Narrow the port, and its inputs, to what this unit uses; a stub then answers its one question.
|
|
17
|
-
- *Behaviour hiding in a collaborator.* The double re-implements logic the unit relies on. That logic is a unit of its own with its own tests; a stub returns its result.
|
|
18
|
-
- *Real I/O in a unit test.* Files, on-disk fixtures, network, the clock. A dependency was reached for, not injected. Inject a port and give the test a stub.
|
|
19
|
-
- *An integration test with a unit suffix.* It wires several units over real backings. Move it to the integration layer, and keep that layer thin.
|
|
20
|
-
|
|
21
|
-
**Where to go.** Unit tests give every collaborator a stub or spy with canned answers. On-disk fixtures are integration test tools: used at a bare minimum, only where the composition under test demands a real backing.
|
|
22
|
-
|
|
23
|
-
**Reactions to distrust.**
|
|
24
|
-
- "It's just tests." The test is the unit's first consumer. A collaborator that is hard to replace with a double is a design finding.
|
|
25
|
-
- "The double must be realistic." Realism belongs in the few integration tests. A unit case needs one fixed answer.
|
|
26
|
-
- "A fixture file is easier." Easier once. Each one ties the test to real I/O and to data the reader cannot see in the test.
|
|
27
|
-
|
|
28
|
-
**Principles behind it.**
|
|
29
|
-
- *Test doubles* (Gerard Meszaros, *xUnit Test Patterns*). Doubles come in kinds; the stub is the simplest double that answers, and a canned answer keeps the test about the unit rather than about the double.
|
|
30
|
-
- *Interface Segregation Principle* (Robert C. Martin, SOLID). A port shaped to one consumer's needs is trivial to stub; a stub that needs logic is reporting a port that serves too many needs.
|
|
31
|
-
- *The test pyramid* (Mike Cohn). Many fast isolated unit tests, few integration tests. Real backings and fixtures belong to the thin upper layer.
|
|
15
|
+
Start from the symptom a finding names: [Double with a body](../typescript/symptoms.md#double-with-a-body). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
|
package/rules/CD-26/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-26 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Module or global patched](../typescript/symptoms.md#module-or-global-patched).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
|
@@ -25,11 +27,11 @@ const subject = createSubject({ store: storeStub });
|
|
|
25
27
|
Pass the collaborator in as a dependency and hand the test a stub.
|
|
26
28
|
|
|
27
29
|
## Exceptions
|
|
28
|
-
Add an entry to `discipline-exceptions.json` at the repository root. Use `
|
|
30
|
+
Add an entry to `discipline-exceptions.json` at the repository root. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. The form accepts an `authorised-location` for this clause, as for any; in spirit [Module or global patched](../typescript/symptoms.md#module-or-global-patched) has no correct use, and a reviewer refuses one. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
|
|
29
31
|
|
|
30
32
|
```json
|
|
31
33
|
{ "version": 1, "exceptions": [
|
|
32
|
-
{ "kind": "
|
|
34
|
+
{ "kind": "file-carve-out", "clause": "CD-26#module-mocking", "file": "src/legacy/payments.test.ts" }
|
|
33
35
|
] }
|
|
34
36
|
```
|
|
35
37
|
|
package/rules/CD-26/README.md
CHANGED
|
@@ -2,28 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
7
|
+
**Verdict.** Symptom of Written-out answers, Ports declared inside.
|
|
10
8
|
|
|
11
|
-
**
|
|
9
|
+
**Read.** [Written-out answers](../rules.md#written-out-answers), [Ports declared inside](../rules.md#ports-declared-inside) and [Ports in the argument](../typescript/recipes.md#ports-in-the-argument).
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- *A collaborator imported, not received.* The unit reaches its dependency through an import. Make it a port the unit receives in its argument.
|
|
15
|
-
- *No place that wires.* Nothing builds the real dependencies and passes them in, so imports are the only wiring there is. Create one composition root.
|
|
16
|
-
- *A port too big to stub.* Replacing the whole module is easier than writing doubles for a wide port. Narrow the port to what this unit uses.
|
|
17
|
-
- *Ambient capabilities.* Time, randomness, environment or the filesystem read directly. Same cause; see CD-17 and CD-19.
|
|
18
|
-
|
|
19
|
-
**Where to go.** Every collaborator arrives through the unit's own signature. Tests hand in test doubles exactly the way production hands in the real thing. Start with the module mocked most often; one port at a time.
|
|
11
|
+
Review lens: [di-discipline](../../methods/lenses/di-discipline.md), [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
- "It's just tests." The module-mock is the test reporting the design. The fix is in the unit.
|
|
23
|
-
- "The framework's docs mock modules." A framework idiom does not make the seam right. Wrap the framework behind a port.
|
|
24
|
-
- "Rewiring is too big." It is one port at a time, and each one removes a module-mock for good.
|
|
13
|
+
## Spirit
|
|
25
14
|
|
|
26
|
-
|
|
27
|
-
- *Dependency Inversion Principle* (Robert C. Martin, SOLID). The unit depends on an abstraction it is given, not on a concrete module it imports.
|
|
28
|
-
- *Dependency injection and the composition root.* Dependencies are built in one place and passed in, so any of them can be replaced without touching the unit.
|
|
29
|
-
- *Ports and adapters* (Alistair Cockburn, hexagonal architecture). A test is one more adapter plugged into the same port.
|
|
15
|
+
Start from the symptom a finding names: [Module or global patched](../typescript/symptoms.md#module-or-global-patched). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours) and [External behaviour sits at a boundary](../principles.md#external-behaviour-sits-at-a-boundary).
|
package/rules/CD-27/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-27 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptoms: [Branch in a test](../typescript/symptoms.md#branch-in-a-test), [Computed value in a test](../typescript/symptoms.md#computed-value-in-a-test), [Rebinding](../typescript/symptoms.md#rebinding), [Text past its reader](../typescript/symptoms.md#text-past-its-reader) and [Test switched off](../typescript/symptoms.md#test-switched-off). The test-logic check also sees the `let` form of [Answer set in a hook](../typescript/symptoms.md#answer-set-in-a-hook), and `try`, a form of [Throw or catch in a test](../typescript/symptoms.md#throw-or-catch-in-a-test).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
|
@@ -35,7 +37,7 @@ Edition 2 also flags:
|
|
|
35
37
|
- `??`, `||` and `&&`, and their assignment forms `??=`, `||=` and `&&=`.
|
|
36
38
|
- Optional chaining: `a?.b`, `a?.[key]` and `f?.()`.
|
|
37
39
|
- `switch` statements.
|
|
38
|
-
- Computing calls on a built-in namespace: `JSON.stringify`, `JSON.parse`, `Object.assign`, `Object.fromEntries`, `Array.from` and any `Math` method. A finding on `JSON.stringify` or `JSON.parse`
|
|
40
|
+
- Computing calls on a built-in namespace: `JSON.stringify`, `JSON.parse`, `Object.assign`, `Object.fromEntries`, `Array.from` and any `Math` method. A finding on `JSON.stringify` or `JSON.parse` names [Serialising or parsing JSON](#serialising-or-parsing-json).
|
|
39
41
|
|
|
40
42
|
Neither edition flags element access such as `calls[0]`, calls to free functions, a method called through a computed key, such as `rows["map"]`, or text built with a template literal. Helper files that tests import are not checked; only the test files themselves are.
|
|
41
43
|
|
|
@@ -68,7 +70,7 @@ Write the expected value out. A method call in the act step is flagged too, so m
|
|
|
68
70
|
Each finding ends with `fix:` and the page and section for what it flagged, such as `(node_modules/@hailstails/hone/rules/CD-27/CHECKS.md#an-optional-chain-after-an-index)`.
|
|
69
71
|
|
|
70
72
|
## Allowed forms in a test
|
|
71
|
-
Each section shows a flagged form first, then the forms to write instead
|
|
73
|
+
Each section shows a flagged form first, then the forms to write instead. Every form to write instead passes every audit and ESLint clause Hone ships, at each edition its check declares, and compiles under the compiler options CD-3 requires. A test reads this page and holds every block on it to that. `assert`, `expect`, `it` and `vi` come from `vitest`, and a `declare const` line stands for the unit under test.
|
|
72
74
|
|
|
73
75
|
### Branching with if
|
|
74
76
|
```ts
|
|
@@ -359,7 +361,14 @@ it.each([
|
|
|
359
361
|
declare const render: (row: { readonly id: string }) => string;
|
|
360
362
|
expect(JSON.parse(render({ id: "a" }))).toEqual({ id: "a" });
|
|
361
363
|
```
|
|
362
|
-
A finding on `JSON.stringify` or `JSON.parse` names this section.
|
|
364
|
+
A finding on `JSON.stringify` or `JSON.parse` names this section. Assert the object the unit gives back, written out:
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
declare const rowOf: (row: { readonly id: string }) => { readonly id: string };
|
|
368
|
+
expect(rowOf({ id: "a" })).toEqual({ id: "a" });
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
A unit that gives back only text should hand over an object, leaving the text to the adapter at its edge.
|
|
363
372
|
|
|
364
373
|
### Merging objects
|
|
365
374
|
```ts
|
|
@@ -437,14 +446,14 @@ expect(isInstalled({ kindOf })).toBe("installed");
|
|
|
437
446
|
expect(kindOf).toHaveBeenCalledExactlyOnceWith("bin/hone.js");
|
|
438
447
|
```
|
|
439
448
|
|
|
440
|
-
[
|
|
449
|
+
The recipe is [Stub with vi.fn](../typescript/recipes.md#stub-with-vifn).
|
|
441
450
|
|
|
442
451
|
## Exceptions
|
|
443
|
-
Add an entry to `discipline-exceptions.json` at the repository root. Use `
|
|
452
|
+
Add an entry to `discipline-exceptions.json` at the repository root. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. The form accepts an `authorised-location` for this clause, as for any; in spirit [Branch in a test](../typescript/symptoms.md#branch-in-a-test) and [Computed value in a test](../typescript/symptoms.md#computed-value-in-a-test) have no correct use, and a reviewer refuses one. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
|
|
444
453
|
|
|
445
454
|
```json
|
|
446
455
|
{ "version": 1, "exceptions": [
|
|
447
|
-
{ "kind": "
|
|
456
|
+
{ "kind": "file-carve-out", "clause": "CD-27#test-body-logic", "file": "src/legacy/report.test.ts" }
|
|
448
457
|
] }
|
|
449
458
|
```
|
|
450
459
|
|
package/rules/CD-27/README.md
CHANGED
|
@@ -2,28 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
7
|
+
**Verdict.** Splits: Straight-through tests; Tested where it's owned.
|
|
10
8
|
|
|
11
|
-
**
|
|
9
|
+
**Read.** [Straight-through tests](../rules.md#straight-through-tests), [Tested where it's owned](../rules.md#tested-where-its-owned), [Assert to narrow](../typescript/recipes.md#assert-to-narrow), [it.each over typed rows](../typescript/recipes.md#iteach-over-typed-rows) and [Whole written-out expectation](../typescript/recipes.md#whole-written-out-expectation).
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- *Output that is hard to predict.* Expectations are computed because the result varies with time, randomness or ordering. Inject the source of variation and pin it with a stub.
|
|
15
|
-
- *Several cases in one test.* A branch or a conditional picks between cases. Write one test per case, or one parameterised test over a table of rows.
|
|
16
|
-
- *The unit's logic repeated in the test.* The test derives the answer the way the unit does. Write the answer out. If that is hard, the unit returns too much for one case or does too much.
|
|
17
|
-
- *Failures caught to inspect them.* A try in a test means the unit throws where it could return its failure as data. Assert on the returned result.
|
|
18
|
-
- *Tests switched off or focused.* A skip or an only hides a failing, slow or flaky case. Fix it or delete it.
|
|
19
|
-
|
|
20
|
-
**Where to go.** Every test is arrange, act, assert, against literal values. Variation comes from injected stubs. N cases are N tests or one table.
|
|
11
|
+
Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
- "It's just a helper in the test." A helper with logic is untested code deciding whether other code passes.
|
|
24
|
-
- "Written-out values are brittle." They break when behaviour changes. That is their job.
|
|
25
|
-
- "The expected value is too big to write." Then the test asserts more than the unit's own responsibility, or the unit does too much.
|
|
13
|
+
## Spirit
|
|
26
14
|
|
|
27
|
-
|
|
28
|
-
- *Conditional Test Logic* (a test smell in Gerard Meszaros, *xUnit Test Patterns*). A test with branches can pass without checking what it claims to check.
|
|
29
|
-
- *Arrange, act, assert.* One setup, one action, one check: the shape that makes a test a readable specification.
|
|
15
|
+
Start from the symptom a finding names: [Branch in a test](../typescript/symptoms.md#branch-in-a-test), [Computed value in a test](../typescript/symptoms.md#computed-value-in-a-test), [Rebinding](../typescript/symptoms.md#rebinding), [Text past its reader](../typescript/symptoms.md#text-past-its-reader) and [Test switched off](../typescript/symptoms.md#test-switched-off). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
|
package/rules/CD-28/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-28 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Behaviour tested away from its owner](../typescript/symptoms.md#behaviour-tested-away-from-its-owner).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
|
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
|
|
|
10
12
|
|
|
11
13
|
## How it is checked
|
|
12
14
|
|
|
13
|
-
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the
|
|
15
|
+
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
|
package/rules/CD-28/README.md
CHANGED
|
@@ -2,24 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
7
|
+
**Verdict.** Merges into [Written-out answers](../rules.md#written-out-answers).
|
|
10
8
|
|
|
11
|
-
**
|
|
9
|
+
**Read.** [Written-out answers](../rules.md#written-out-answers).
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- *Assertions reaching through stubs.* The test checks what a stub returned, not what the unit did with it. Assert the unit's output and the calls it made.
|
|
15
|
-
- *A real collaborator in the test.* The test asserts results produced by code it does not own. Replace it with a stub.
|
|
16
|
-
- *A unit that passes values through.* The only thing to check is a delegate's output. The unit may have no responsibility of its own; question it.
|
|
17
|
-
|
|
18
|
-
**Where to go.** Each test asserts the unit's own output and the exact calls it makes. Collaborators have their own tests.
|
|
11
|
+
Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
- "Testing through gives more confidence." It gives confidence about the collaborator, and blame in the wrong place when it fails.
|
|
13
|
+
## Spirit
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
- *Defect localisation.* A test that can fail only when its own unit is wrong points straight at the fault.
|
|
25
|
-
- *Fragile Test* (a test smell in Gerard Meszaros, *xUnit Test Patterns*). Tests that depend on more than the unit break for reasons unrelated to it.
|
|
15
|
+
Start from the symptom a finding names: [Behaviour tested away from its owner](../typescript/symptoms.md#behaviour-tested-away-from-its-owner) and [Unasserted call](../typescript/symptoms.md#unasserted-call). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
|
package/rules/CD-29/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-29 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Integration-heavy suite](../typescript/symptoms.md#integration-heavy-suite).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
|
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
|
|
|
10
12
|
|
|
11
13
|
## How it is checked
|
|
12
14
|
|
|
13
|
-
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the
|
|
15
|
+
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
|
package/rules/CD-29/README.md
CHANGED
|
@@ -2,22 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
7
|
+
**Verdict.** Merges into [Tested where it's owned](../rules.md#tested-where-its-owned).
|
|
10
8
|
|
|
11
|
-
**
|
|
9
|
+
**Read.** [Tested where it's owned](../rules.md#tested-where-its-owned) and [Integration test suffix](../typescript/recipes.md#integration-test-suffix).
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- *Units that cannot be tested alone.* Integration tests carry the load because units take no injected dependencies. Inject them; unit tests follow.
|
|
15
|
-
- *Logic tested through the system.* Business rules are checked end to end. Move each rule's cases to the unit that owns it.
|
|
16
|
-
|
|
17
|
-
**Where to go.** Many unit tests, few component tests, a thin smoke layer.
|
|
11
|
+
Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
- "Integration tests catch real bugs." They catch wiring bugs. Logic bugs belong to unit tests that run in milliseconds.
|
|
13
|
+
## Spirit
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
- *The test pyramid* (Mike Cohn). Many fast unit tests at the base, fewer broader tests above.
|
|
15
|
+
Start from the symptom a finding names: [Integration-heavy suite](../typescript/symptoms.md#integration-heavy-suite). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
|
package/rules/CD-3/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-3 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Strictness weakened](../typescript/symptoms.md#strictness-weakened).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
package/rules/CD-3/README.md
CHANGED
|
@@ -2,25 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
7
|
+
**Verdict.** Cases: strictest checker setting.
|
|
10
8
|
|
|
11
|
-
**
|
|
9
|
+
**Read.** Sets how strictly the checker works ([cases](../cases.md#the-type-checker-proves-it)) and [Shared strict base config](../typescript/recipes.md#shared-strict-base-config).
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- *Errors switched off instead of fixed.* A flag was relaxed because turning it on produced many errors. Those errors are the real finding; fix them by area.
|
|
15
|
-
- *A package that was never brought up to standard.* Legacy or imported code was given its own looser config. Raise it, starting with the flag that hides the most.
|
|
16
|
-
- *Types wrong at a boundary.* Indexed or optional access errors cluster around outside data. Parse that data into exact types at the boundary.
|
|
17
|
-
|
|
18
|
-
**Where to go.** Every unit inherits the one strict configuration and overrides nothing.
|
|
11
|
+
Review lens: [type-soundness](../../methods/lenses/type-soundness.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
- "This flag is too strict for our code." It reports the cases your code does not handle. Handle them.
|
|
22
|
-
- "Just for this package." A relaxed corner spreads: code moves, and the looser rules move with it.
|
|
13
|
+
## Spirit
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
- *Broken windows* (Andrew Hunt and David Thomas, *The Pragmatic Programmer*). One tolerated lapse signals that lapses are acceptable, and more follow.
|
|
26
|
-
- *Fail fast.* A strict compiler reports the defect when it is written, not when it runs.
|
|
15
|
+
Start from the symptom a finding names: [Strictness weakened](../typescript/symptoms.md#strictness-weakened). Each symptom names the cases it may indicate and the rules they point at. The why is on [The type checker proves it](../principles.md#the-type-checker-proves-it).
|
package/rules/CD-30/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-30 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Behaviour tested away from its owner](../typescript/symptoms.md#behaviour-tested-away-from-its-owner).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
|
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
|
|
|
10
12
|
|
|
11
13
|
## How it is checked
|
|
12
14
|
|
|
13
|
-
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the
|
|
15
|
+
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
|
package/rules/CD-30/README.md
CHANGED
|
@@ -2,23 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
7
|
+
**Verdict.** Merges into [Tested where it's owned](../rules.md#tested-where-its-owned).
|
|
10
8
|
|
|
11
|
-
**
|
|
9
|
+
**Read.** [Tested where it's owned](../rules.md#tested-where-its-owned) and [Integration test suffix](../typescript/recipes.md#integration-test-suffix).
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- *A missing unit test.* A logic bug surfaced first in integration. Add the unit test at the base.
|
|
15
|
-
- *Integration tests asserting logic.* The test checks calculations, not connections. Move those cases down.
|
|
16
|
-
|
|
17
|
-
**Where to go.** Integration tests check that units connect correctly. Unit tests check what each unit computes.
|
|
11
|
+
Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
- "It's more realistic." Realism costs speed and precision. Spend it on wiring only.
|
|
13
|
+
## Spirit
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
- *The test pyramid* (Mike Cohn). Each layer has a job; broad tests are few because they localise faults poorly.
|
|
24
|
-
- *Defect localisation.* A failing test should point at the fault. A logic failure in an integration test points at the whole system.
|
|
15
|
+
Start from the symptom a finding names: [Behaviour tested away from its owner](../typescript/symptoms.md#behaviour-tested-away-from-its-owner). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
|
package/rules/CD-31/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-31 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Symptom: [Coverage gate](../typescript/symptoms.md#coverage-gate).
|
|
4
|
+
|
|
5
|
+
Read [the verdict and the named pages it points at](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
|
@@ -10,4 +12,4 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
|
|
|
10
12
|
|
|
11
13
|
## How it is checked
|
|
12
14
|
|
|
13
|
-
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the
|
|
15
|
+
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the named rules](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
|
package/rules/CD-31/README.md
CHANGED
|
@@ -2,22 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) maps each number to its names.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
7
|
+
**Verdict.** Check of [Tested where it's owned](../rules.md#tested-where-its-owned).
|
|
10
8
|
|
|
11
|
-
**
|
|
9
|
+
**Read.** [Tested where it's owned](../rules.md#tested-where-its-owned).
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- *A number standing in for a floor.* The threshold exists because nothing guaranteed every unit a test. The every-file sibling rule is that floor.
|
|
15
|
-
- *Tests written to move the number.* Tests with no real assertions appear. Remove them; read coverage as a diagnostic.
|
|
16
|
-
|
|
17
|
-
**Where to go.** Coverage is read to find untested behaviour, never gated.
|
|
11
|
+
Review lens: [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
- "Without a target, coverage will drop." The sibling rule holds the floor; the number is for reading.
|
|
13
|
+
## Spirit
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
- *Goodhart's law*, in Marilyn Strathern's phrasing: "When a measure becomes a target, it ceases to be a good measure."
|
|
15
|
+
Start from the symptom a finding names: [Coverage gate](../typescript/symptoms.md#coverage-gate). Each symptom names the cases it may indicate and the rules they point at. The why is on [Tests are ours](../principles.md#tests-are-ours).
|
package/rules/CD-32/CHECKS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CD-32 checks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Outside the cases: no symptom. [Every CD](../numbers.md) says where each number went.
|
|
4
|
+
|
|
5
|
+
Read [the rule and its spirit](README.md) first; the [named pages](../README.md) govern where they differ. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
6
|
|
|
5
7
|
## Clauses
|
|
6
8
|
|
package/rules/CD-32/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## Rule
|
|
4
4
|
|
|
5
|
+
This numbered page is the earlier form of this rule. The [named pages](../README.md) govern where they differ, and [Every CD](../numbers.md) says where each number went.
|
|
6
|
+
|
|
5
7
|
Structured logs redact personally-identifying data by default; a field becomes loggable only by explicitly opting in as safe. Redaction is the default so a new field is never accidentally leaked into logs — safety is the resting state, exposure the deliberate exception.
|
|
6
8
|
|
|
7
9
|
Review lens: [clean-architecture](../../methods/lenses/clean-architecture.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|