okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

Aly Raffaufchore: remove audit cruft and exclude generated reports29ab440

main
3.4 KiB69 linesraw

Run the Gleam commit check

The Nix development shell supplies glinter, pinned by flake.lock, with its upstream dependencies locked separately from the daemon. Run the commit check with:

nix develop -c test/gleam-lint.sh

The default uses the focused policy in gleam.toml. --review adds checks that need caller and failure-contract inspection, using test/manual/glinter-review.toml. --all uses test/manual/glinter-all.toml. Both optional profiles run through a temporary project with symlinks to this checkout. The commit hook runs the default profile when Gleam files or lint configuration change; it checks all source and test modules. test.sh runs the same profile before the build and test suites. Neither optional profile is a commit requirement.

For manual review and audit reports, run:

nix develop -c test/gleam-lint.sh --review --format json > /tmp/albedo-review.json
nix develop -c test/gleam-lint.sh --all --format json > /tmp/albedo-audit.json

Keep generated reports under /tmp. Do not commit CSV inventories or retrospective cleanup reports.

The default enables eleven rules as errors:

PurposeRules
Explicit signatures and existing labelsmissing_type_annotation, missing_labels
Imports and redundant bindingsunqualified_import, duplicate_import, unnecessary_variable
Debug and unfinished codeecho, avoid_todo, todo_without_message
Invalid arithmeticdivision_by_zero
Suppression hygienenolint_unused, nolint_inline

A default run promotes all findings to errors and exits unsuccessfully when it finds one.

These checks catch accidental debug or unfinished code and keep signatures, imports, and existing labels consistent. Acceptance requires zero findings, without a warning allowance or a growing baseline. Keep a rule in the commit profile only when its findings warrant a concrete fix across production and tests. Rules that need application context belong in manual review.

--review retains those errors and adds warnings for production assertions and panics, discarded values and errors, lost error context, unused exports, and single-branch cases. Inspect these against their callers and failure contracts. A warning alone does not establish a defect. In particular, the discarded-value rule also flags Nil, Bool, timer handles, monitor handles, and process handles.

Keep tests exported for discovery. Test assertions and deliberate failure sentinels are exempt from assertion, panic, and unused-export checks. Annotations and existing-label checks still apply to tests.

Both focused and review profiles disable short-name and trailing-underscore preferences, blanket labels, guard preferences, string-error bans, unwrap bans, literal-concatenation bans, complexity thresholds, and inspection bans. Keep diagnostic inspection and readable SQL construction. Keep JS FFI checking disabled for the Erlang target.

In the audited glinter version, findings can retain their default severity even when configuration enables them as errors. A debug echo probe confirmed this; the focused profile uses warnings_as_errors to enforce its failure status. The review profile is for inspection, so its exit status is not an acceptance check. Unwrap and complexity findings retain off in the all-rules JSON report. off therefore does not mean that the all-rules run skipped those checks.

1# Run the Gleam commit check
2
3The Nix development shell supplies glinter, pinned by `flake.lock`, with its
4upstream dependencies locked separately from the daemon.
5Run the commit check with:
6
7```sh
8nix develop -c test/gleam-lint.sh
9```
10
11The default uses the focused policy in `gleam.toml`. `--review` adds checks that
12need caller and failure-contract inspection, using `test/manual/glinter-review.toml`.
13`--all` uses `test/manual/glinter-all.toml`. Both optional profiles run through a
14temporary project with symlinks to this checkout. The commit hook runs the default
15profile when Gleam files or lint configuration change; it checks all source and
16test modules. `test.sh` runs the same profile before the build and test suites.
17Neither optional profile is a commit requirement.
18
19For manual review and audit reports, run:
20
21```sh
22nix develop -c test/gleam-lint.sh --review --format json > /tmp/albedo-review.json
23nix develop -c test/gleam-lint.sh --all --format json > /tmp/albedo-audit.json
24```
25
26Keep generated reports under `/tmp`. Do not commit CSV inventories or
27retrospective cleanup reports.
28
29The default enables eleven rules as errors:
30
31| Purpose | Rules |
32| --- | --- |
33| Explicit signatures and existing labels | `missing_type_annotation`, `missing_labels` |
34| Imports and redundant bindings | `unqualified_import`, `duplicate_import`, `unnecessary_variable` |
35| Debug and unfinished code | `echo`, `avoid_todo`, `todo_without_message` |
36| Invalid arithmetic | `division_by_zero` |
37| Suppression hygiene | `nolint_unused`, `nolint_inline` |
38
39A default run promotes all findings to errors and exits unsuccessfully when it
40finds one.
41
42These checks catch accidental debug or unfinished code and keep signatures,
43imports, and existing labels consistent. Acceptance requires zero findings,
44without a warning allowance or a growing baseline. Keep a rule in the commit
45profile only when its findings warrant a concrete fix across production and
46tests. Rules that need application context belong in manual review.
47
48`--review` retains those errors and adds warnings for production assertions and
49panics, discarded values and errors, lost error context, unused exports, and
50single-branch cases. Inspect these against their callers and failure contracts.
51A warning alone does not establish a defect. In particular, the discarded-value rule also flags
52`Nil`, `Bool`, timer handles, monitor handles, and process handles.
53
54Keep tests exported for discovery. Test assertions and deliberate failure
55sentinels are exempt from assertion, panic, and unused-export checks. Annotations
56and existing-label checks still apply to tests.
57
58Both focused and review profiles disable short-name and trailing-underscore
59preferences, blanket labels, guard preferences, string-error
60bans, unwrap bans, literal-concatenation bans, complexity thresholds, and
61inspection bans. Keep diagnostic inspection and readable SQL construction. Keep
62JS FFI checking disabled for the Erlang target.
63
64In the audited glinter version, findings can retain their default severity even
65when configuration enables them as errors. A debug `echo` probe confirmed this;
66the focused profile uses `warnings_as_errors` to enforce its failure status.
67The review profile is for inspection, so its exit status is not an acceptance
68check. Unwrap and complexity findings retain `off` in the all-rules JSON report.
69`off` therefore does not mean that the all-rules run skipped those checks.