treefmt --fail-on-change падал на файлах, которые сама эта ветка и принесла:
checks.sh, config-fingerprint.sh и runtime-drift.sh не были shfmt-чистыми.
Форматтер, который красный на собственной ветке, — не форматтер.
Сделано:
* три скрипта этой ветки отформатированы (shfmt -i 2 -ci);
* .agent/src/install.sh исключён из treefmt: он старый, 487 строк diff'а,
и переписывать чужой инсталлятор — решение владельца, не форматтера;
* shellcheck добавлен в devshell .#fmt и в checks.sh (check #13); если
shellcheck нет в PATH — проверка SKIP, а не FAIL;
* поправлены протухшие комментарии treefmt.toml: output'а formatter у
флейка нет (ADR-0011), а .ci/flake-checks.nix удалён.
Заодно в шапке config-fingerprint.sh зафиксирован грабли, который стоил
часа поиска: обе ревизии надо материализовать одинаково (git archive),
иначе исполняемый бит одного файла меняет store path whitesur-kde, а за
ним system-path, XDG_DATA_DIRS и X-Restart-Triggers — при полностью
идентичном содержимом.
38 lines
1.5 KiB
TOML
38 lines
1.5 KiB
TOML
# treefmt configuration — one entry point for every formatter in the repo.
|
|
#
|
|
# How to use it:
|
|
# nix develop .#fmt --command treefmt # apply the style
|
|
# nix develop .#fmt --command treefmt -- --fail-on-change . # CI-style gate
|
|
#
|
|
# There is deliberately NO `formatter` output in flake.nix: on the pinned
|
|
# nixpkgs `nix flake check` fails with "'outPath' is not a valid system type"
|
|
# on any derivation output, so the formatter lives in a devshell instead
|
|
# (see the note in flake.nix and ADR-0011).
|
|
#
|
|
# Current state (measured 2026-11-15):
|
|
# * all 138 tracked .nix files are nixfmt-clean — the formatter guards
|
|
# against future drift, it does not reformat the repository;
|
|
# * the repository's own shell scripts are shfmt-clean;
|
|
# * .agent/src/install.sh is EXCLUDED below: it predates the formatter and
|
|
# was never shfmt-formatted (487 diff lines). Reformatting somebody
|
|
# else's installer is the owner's call, not the formatter's.
|
|
#
|
|
# Deliberately absent: a JSON/YAML formatter. The .agent artefacts are
|
|
# hand-written and reformatting them would bury every real diff in noise.
|
|
# ShellCheck is a linter, not a formatter — it runs as its own check
|
|
# (see check #13 in .ci/checks.sh).
|
|
|
|
[global]
|
|
# A formatter that fails must not stop the others: report and continue.
|
|
onfail = "append"
|
|
|
|
[formatter.nixfmt]
|
|
command = "nixfmt"
|
|
includes = ["**/*.nix"]
|
|
|
|
[formatter.shfmt]
|
|
command = "shfmt"
|
|
args = ["-i", "2", "-ci", "-w"]
|
|
includes = ["**/*.sh"]
|
|
excludes = [".agent/src/install.sh"]
|